Create JPEG or GIF

Everything else that doesn't fall into one of the other PB categories.
User avatar
digital32
User
User
Posts: 23
Joined: Fri Dec 28, 2012 1:28 am

Create JPEG or GIF

Post 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..
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Create JPEG or GIF

Post 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)
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8425
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Create JPEG or GIF

Post 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
BERESHEIT
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create JPEG or GIF

Post 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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Create JPEG or GIF

Post 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 ?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create JPEG or GIF

Post 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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Create JPEG or GIF

Post 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. :wink:
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create JPEG or GIF

Post by J. Baker »

wilbert wrote: It's no problem to decode the image, the problem is understanding the ImagePlugin procedures Fred created. :wink:
Oh, I see. :wink:
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Create JPEG or GIF

Post by wilbert »

J. Baker wrote:
wilbert wrote: It's no problem to decode the image, the problem is understanding the ImagePlugin procedures Fred created. :wink:
Oh, I see. :wink:
I already found it.
I forgot so init the ID variable :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create JPEG or GIF

Post by J. Baker »

wilbert wrote: I already found it.
I forgot so init the ID variable :)
You're fast. Glad to hear. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Create JPEG or GIF

Post 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.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Create JPEG or GIF

Post 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
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Create JPEG or GIF

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create JPEG or GIF

Post 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! :D
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Create JPEG or GIF

Post 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 8)
ImageThe happiness is a road...
Not a destination
Post Reply