SFML community forums

Help => Graphics => Topic started by: Joshua Flynn on September 01, 2011, 12:10:32 pm

Title: Save and load images as animated GIFs
Post by: Joshua Flynn on September 01, 2011, 12:10:32 pm
Is this possible with SFML? If so, how?

Thank you.
Title: Save and load images as animated GIFs
Post by: Laurent on September 01, 2011, 12:22:18 pm
SFML doesn't support animated GIFs. If you want to handle animations, you should rather use sprite sheets in PNG format.
Title: Save and load images as animated GIFs
Post by: Joshua Flynn on September 01, 2011, 01:27:34 pm
Quote from: "Laurent"
SFML doesn't support animated GIFs. If you want to handle animations, you should rather use sprite sheets in PNG format.


The issue is I am downloading GIFs from a website, and merging them into an animated GIF would likely save space. Will there be any support for it in the future?
Title: Save and load images as animated GIFs
Post by: Laurent on September 01, 2011, 02:07:32 pm
No, animated GIFs don't make much sense in this context.

How would you save space with animated GIFs, compared to a sprite sheet?
Title: Save and load images as animated GIFs
Post by: Joshua Flynn on September 01, 2011, 02:48:48 pm
Quote from: "Laurent"
No, animated GIFs don't make much sense in this context.

How would you save space with animated GIFs, compared to a sprite sheet?


Shared colour table, I believe? I'm just skimming the unfreeze source code figuring out it works and gathering information on the GIF arrangements. It seems straight-forward enough (just tricky in you need to know how it's arranged - working on that). If I get a working assembler/disassembler class built from scratch I'll throw it your way and give you the rights for it.

Besides, it's easier to manage than hundreds of images named map_2011090100500 (incremental).
Title: Save and load images as animated GIFs
Post by: Laurent on September 01, 2011, 03:29:01 pm
Quote
Shared colour table, I believe?

Hmm, do you really need to go that far in space saving?

Quote
If I get a working assembler/disassembler class built from scratch I'll throw it your way and give you the rights for it.

don't bother too much with that, because:
- I would have to forward it to this guy who writes stb_image (which SFML uses to load images)
- Neither SFML not stb_image has support for animated images, so how would this be integrated to the existing API?

Quote
Besides, it's easier to manage than hundreds of images named map_2011090100500 (incremental).

A sprite sheet is rather a single image containing a grid of all animation frames.
Title: Save and load images as animated GIFs
Post by: Joshua Flynn on September 01, 2011, 04:27:30 pm
http://www.2shared.com/photo/f-dmRDTA/Cali2.html
Quote from: "Laurent"
- I would have to forward it to this guy who writes stb_image (which SFML uses to load images)
- Neither SFML not stb_image has support for animated images, so how would this be integrated to the existing API?


Being an assembly/disassembly program, all it would do is load a looped GIF as separate images (so as an array of sf::Images), and save an array of GIF images. I'll specify the details once I've understood the underlying operations, but in effect it will be a class that acts as a go between for animated GIF files and sf::Images.

I'll have to study it more though. But if I do get it, expect a neat class with a nice interface.