Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Save and load images as animated GIFs  (Read 4927 times)

0 Members and 1 Guest are viewing this topic.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Save and load images as animated GIFs
« on: September 01, 2011, 12:10:32 pm »
Is this possible with SFML? If so, how?

Thank you.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Save and load images as animated GIFs
« Reply #1 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.
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Save and load images as animated GIFs
« Reply #2 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Save and load images as animated GIFs
« Reply #3 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?
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Save and load images as animated GIFs
« Reply #4 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).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Save and load images as animated GIFs
« Reply #5 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.
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Save and load images as animated GIFs
« Reply #6 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.

 

anything