Sign in to follow this  
Alpha Nox

Display animated gif file in SDL

Recommended Posts

vbuser1338    175
You could find out how to load the animated gif file so you would have to find an article or file specification and load that. Then you can probably create an SDL_Image and then use it that way. It would probably be easier to just use an image editing program to split it into bmps and use SDL to load the images.

Share this post


Link to post
Share on other sites
Drew_Benton    1861
In short, there is no easier way avaliable. SDL_Image only supports the first frame of a GIF, so you will have to manually create each SDL_Surface for each frame, then store those, then setup your own playback system.

Share this post


Link to post
Share on other sites
Mikha    118
Sorry for my ignorance, but why would one separate a gif file into multiple bmp files? Why not multiple gif or png files? Actually, the very existence of the bmp format in modern image manipulation programs has baffled me, so the answer to my question might reveal an answer to two questions.

Share this post


Link to post
Share on other sites
Drew_Benton    1861
Quote:
Original post by Mikha
Sorry for my ignorance, but why would one separate a gif file into multiple bmp files? Why not multiple gif or png files? Actually, the very existence of the bmp format in modern image manipulation programs has baffled me, so the answer to my question might reveal an answer to two questions.


Because when it comes down to it, for any compressed format, MP3, OGG, PNG, etc.. they are decompressed into some base format, wav, bmp, etc... to be used. Sure storing in PNG/GIF formats saves space, but increases the CPU consumption in terms of processing resources. The converse is true with BMPS, less CPU processing, but more space taken up. There's no 'better chocie' between the two, it just depends on what you are doing. If you have large files, and are distributing your game, PNG might work a bit better in the long run, but if they are smaller files, BMPS might actually prove faster. Now I do not know if that's necessarily true with how SDL works, but the similar concept is true with audio files, so it just depeds on the library being used as well.

Share this post


Link to post
Share on other sites
Vexorian    152
Actually the 'huge' increment on cpu usage would only happen when loading the file at the start of the game? And bmp images don't have transparency channels unlike pngs

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this