GIF handling in Blitzmax?
BlitzMax Forums/BlitzMax Beginners Area/GIF handling in Blitzmax?
| ||
Hey, I'm new to BlitzMax and tried a few things out today. I'm really keen on getting more knowledge because BlitzMax is a wonderful language. But now there's a problem: I can't load GIF graphics / display them. ---------------------------------------- Here's the code: ---------------------------------------- SuperStrict Graphics 320, 240, 0 IncBin "images/sample.gif" Local myGif:TImage = LoadImage("incbin::images/sample.gif") While not KeyHit(KEY_ESCAPE) Cls DrawImage myGif, 10, 10 Flip Wend ---------------------------------------- So what's wrong? Thanks in advance |
| ||
There's no GIF support in Bmax |
| ||
it support png and bmp. in case you don't know, you can save your image into a png or a bmp image with microsoft paint program. Just load it in to the paint program and use "save as" and choose the format in the save as type. |
| ||
Gif is an aweful image format anyway, unless its a photograph, png is your friend |
| ||
Import - BMP, JPG, PNG and TGA Export - PNG and JPG |
| ||
PNG was designed to succeed GIF and does pretty much everything better, except animation frames. |
| ||
I think this answeres my question... So in order to get a full animation I'll need an animation-sprite-strip and load it with LoadAnimImage() ? |
| ||
yep |
| ||
I'm not quite ready but there should be gif support added to the axe modules shortly. Here is the reader in it's current state, use LoadImage(pixmap) with the pixmap result in my test code if you want to play with it: or try the following untested wrapper: Function LoadGif:TImage(url:Object) Local stream:TStream Local pixmaps:TList Local pix:TPixmap stream=ReadFile(url) If stream pixmaps=ReadGifPixmaps(stream) CloseFile stream If pixmaps pix=TPixmap(pixmaps.valueatindex(0)) Return LoadImage(pix) EndIf EndIf End Function |
| ||
saving too? |
| ||
Interesting enough: The last patents on the GIF file format expire on october 1st, 2006, making GIF truly 'free' to use again just 2 days from now. http://www.freesoftwaremagazine.com/node/1772 |
| ||
@skidracer: Thanks for the code. I haven't tried it out yet, but I will do today. I'll post my success here in this topic. @xlsior: Interesting. Could this mean that Mark will include a GIF support within the next Updates of BlitzMax? |
| ||
I'm not quite ready but there should be gif support added to the axe modules shortly |
| ||
@skidracer: Your code works fine. The gif images are displayed correctly but there is just on problem: There is no transparency, instead of this a magenta color is shown. I guess I can remove the magenta color by setting the mask color, correct? Anyone got a little piece of code for me? |
| ||
It should already support alpha, if you can, please email me your gif so I can test. The loader still needs per frame palette support which I can put in soon and there may be a bug with the background color support, will test. |
| ||
This is the gif picture:![]() |
| ||
oops change ReadGifPixmaps at ~ line 84 to:parsegif(pixmaps,stream,pal,_flags) |
| ||
yep, that works! Thank you very much |
| ||
I'm not quite ready but there should be gif support added to the axe modules shortly. Hi, sorry for bumping an old thread like this, but might this still happen? I just synched with axe enabled but all I see is a module to load jpg2000. (Don't worry, I'm not planning on using gif files as game graphics, it's for a program that can load image files from the user, so the more supported formats the better.) |
| ||
Yeah gif would be nince since it is still in use quite a bit on the web, even though png is in most cases much nicer (then then png is nicer than bmp but we have that too). Anyone want to do an IFF/ILBM loader? I did one in basic a while ago, wasn't too hard. |
| ||
Hmm...I can't get simon's code to work at all. Anyone have a clear example? |
| ||
Another option, if you need GIF support... there is always my freeimage module - which supports GIF load and save, as well as conversion to lots of other file formats. See link for more details... http://brucey.net/programming/blitz/index.php#bahfreeimage Even supports loading IFF/ILBM (whatever those are)... ;-) |
| ||
Brucey, was your smiley there to indicate that you know what ILBM is from (Amiga), or a serious question? Of note, IFF is the Interchangeable File Format developed by Electronic Arts for Deluxe Paint, but which is meant to be able to store several types of data including audio. It's kind of a flexible file format able to store multiple items - images, sounds, palettes, etc. ILBM is the InterLeaved BitMap which is the format for images that IFF uses. |
| ||
IFF was probably a bit ahead of its time, as far as having the capability to store information other than images in it. Clever idea, but sadly under-exploited. |