Loading or Catching images:
LoadDecodedImage(ImageNumber, Filename$)
CatchDecodedImage(ImageNumber, Address, Length)
Example: CatchDecodedImage(0, ?pic1, ?pic2-pic1)
Both Load and Catch accept #PB_Any and will return same values as corresponding PureBasic native commands.
SaveEncoded(ImageID, codec, filename$)
Where 'codec' is one of the following options:
#GdipCodecs_Bmp = 0
#GdipCodecs_Jpeg = 1
#GdipCodecs_Gif = 2
#GdipCodecs_Tiff = 3
#GdipCodecs_Png = 4
Here is an example test I did during development:
Code: Select all
LoadImage(0,"d:\_tax\kate_moss_gallery_29.bmp")
Debug SaveEncoded(ImageID(0), #GdipCodecs_gif, "d:\gotmilk.gif")
Here's the resulting gif from that test:

And finally, here is the lib:
http://www.networkmaestro.com/GdiplusCodecs.zip
A disadvantage of this library is that it requires Gdiplus.dll, which will be present on all WinXP machines, but you'll have to provide the redistributable dll from MS for other target OS's. Not a huge deal imho.
A real advantage of this lib is it will encode all these formats while only adding 3k to the size of your exe!