Page 1 of 2
Create JPEG or GIF
Posted: Fri Aug 26, 2016 1:09 am
by digital32
Anyone have a JPEG or GIF creator. I need to create simple graphs/line vector input is fine so I can save them and put them into RTF documents that my program creates.
More Info:
I'm building a reporting tool that looks at a lot of data.
I need to graph some of the data and place it into an RTF (Rich Text File) document.
I have already build the RTF creation routines based on other articles.
And I can put JPEG or GIF Files into the RTF output.
.... I just need to build custom JPEGs or GIF files for some simple charting functions.
I'm thinking: (First Thoughts.. Need more thought here...)
#JPEG_Handle.i = JPEG_Create(FName, XSize, YSize ) ; Dots or Resolution... Not sure on this
JPEG_Draw_Line(#JPEG_Handle, Start, Stop, Size, Color) ; Start, Stop and Size would be in # of Dots
Any help would be greatly appreciated..
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 1:30 am
by Keya
simple example to the ball rolling, using PB's native JPEG encoder (doesn't have one for GIF though, but search the forum)
Code: Select all
UseJPEGImageEncoder()
If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
LineXY(5, 5, 150, 150, RGB(0,255,0))
StopDrawing()
EndIf
SaveImage(0, "c:\temp.jpg", #PB_ImagePlugin_JPEG)
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 3:15 am
by netmaestro
I am probably going to write a GIF image plugin for PureBasic this winter when my work slows down, however in the meantime if you're on Windows you can tap gdiplus to load/save gifs:
http://purebasic.fr/english/viewtopic.php?f=12&t=57041
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 3:24 am
by J. Baker
I know some say GIF is dead but that's far from the truth. People still use them in social media, convert part of a video to gif, Itch.io uses them to display animated screen shots for games, animated forum avatars, etc. It's a bit tiresome to hear people state that old technology is dead all the time. I'm glad to hear that netmaestro might work on this if he finds free time this winter. If not, I'm sure someone will eventually tackle this for PB.
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:19 am
by wilbert
netmaestro wrote:I am probably going to write a GIF image plugin
Nice idea.
I looked at the SDK on OSX to see if this would be possible on OSX but the information provided is very limited.
I can get the Check procedure to be called but the Decode or Cleanup procedure is never called.
I have no idea what needs to be set inside the check procedure to make it continue.
Do you know that or maybe Fred can tell ?
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:26 am
by J. Baker
wilbert wrote:Nice idea.
I looked at the SDK on OSX to see if this would be possible on OSX but the information provided is very limited.
I can get the Check procedure to be called but the Decode or Cleanup procedure is never called.
I have no idea what needs to be set inside the check procedure to make it continue.
Do you know that or maybe Fred can tell ?
There's a few ports of
https://www.lcdf.org/gifsicle/ that have source code, including OS X. I haven't looked through it myself but may be of help.
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:28 am
by wilbert
J. Baker wrote:There's a few ports of
https://www.lcdf.org/gifsicle/ that have source code, including OS X. I haven't looked through it myself but may be of help.
It's no problem to decode the image, the problem is understanding the ImagePlugin procedures Fred created.

Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:29 am
by J. Baker
wilbert wrote:
It's no problem to decode the image, the problem is understanding the ImagePlugin procedures Fred created.

Oh, I see.

Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:39 am
by wilbert
J. Baker wrote:wilbert wrote:
It's no problem to decode the image, the problem is understanding the ImagePlugin procedures Fred created.

Oh, I see.

I already found it.
I forgot so init the ID variable

Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 7:43 am
by J. Baker
wilbert wrote:
I already found it.
I forgot so init the ID variable

You're fast. Glad to hear.

Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 8:03 am
by Dude
J. Baker wrote:I know some say GIF is dead but that's far from the truth.
GIF is dead? No way, it's made a massive comeback in recent months as animations again. Everyone literally knows what a GIF is again. It's not dead at all.
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 10:41 am
by Keya
I agree that GIF isnt going anywhere in a hurry (hadnt even heard it was dying)! Just the other month twitter announced they'd raised the size limit of GIFs from 5mb to 15mb
http://www.theverge.com/2016/7/11/12154 ... 15mb-files
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 10:57 am
by wilbert
I got it working on OSX to add #PB_ImagePlugin_GIF support for decode.
Code is a mess right now but hopefully I can post something when I clean it up.
Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 1:20 pm
by J. Baker
wilbert wrote:I got it working on OSX to add #PB_ImagePlugin_GIF support for decode.
Code is a mess right now but hopefully I can post something when I clean it up.
Congrats wilbert! That will be a nice feature!

Re: Create JPEG or GIF
Posted: Fri Aug 26, 2016 1:25 pm
by Kwai chang caine
This subject, come, come and come again since a lot of years.
Numerous thread talk about this, this is one of them
http://forums.purebasic.fr/english/view ... 32#p302432
Fred even promise a day he make this plugin they are a lot of time and nothing

Gif have never dead, always is the king of internet, and like you said, now he restart like a new baby for news functions in social network.
Furthermore, several masters have already making great works about gif, NETMAESTRO, TsSoft, Wilbert, ...i use sometime it, for replace fred plugin.
When i see all this jobs, very wonderfull, i not understand the différence between a full plugin and this reader of gif.
Is it very difficult to start from this existing big codes for create this plugin ??? I don't know..
Me too, i'm very happy to read NETMAESTRO create perhaps a real plugin like native pb for jpg, png...
Like this, the nice smilling frog, can dress on red, for Christmas, and give this plugin, so waiting by the community
