I played around a bit with this GIF: http://www.greensmilies.com/smile/smiley_emoticons_kilroy.gif
As I wanted to see how this class works etc, I tried to split the animated GIF into frames and display all the frames. Well, the problem is that the frame images have different sizes! Frames 0 and 15-18 are fine, the other ones are way smaller. As I didn't see any position information (those frames 1-14 obviously are not in the upper left), there's no way to continue working with those frames.
I know that this is basically how animations work: only the differences are stored. However this should also contain the position of that difference.
So it would be nice if GIFDecoder would either provide those positions as well or (even better) directly return the combined frames (eg. what's visible in the end). Or did I completely miss something and there's an option for this or something else?
Patrick Walde - 2012-11-02 01:46:03 - In reply to message 2 from alex
by only using GIFdecoder, unfortunately no.
You could open the GIF in GIMP, then use Filters > Animation > Deoptimize, export it again and then use GIFdecoder. That should work, however I didn't test it. And it's also not really a solution, more a work-around. Basically we would need such a GIF deoptimizer function implemented in PHP.
alex - 2012-11-04 01:04:30 - In reply to message 3 from Patrick Walde
First of all thank you for responding.
This is exactly what I'm doing now ... I record my gis in animation shop without optimization.
The problem is that now I work with photoshop and it is painful to switch from one to another ... especially for some people I know, and as the only photoshop software.
I figured the same conclusions as you!
But I re-explained the problem with screenshots in case someone pass by and bring a solution.
So I did a little research and now I know why the optimized animations are rendered like that.
I have an idea of how to fix it:
copy and paste frame 2 to frame 1
copy and paste frame 3 to frame 2
but I need the position (binary data gif) top left frames
and I do not know the code in GIFdecoder.class to allow me to retrieve.
I'm sure he does not miss much, because the data "top" and "left" exist in the data.
if I save my images with
fwrite (fopen ("$ .. / test/frame0 I.gif", "wb") $ frames [$ i]);
frames are small, but if I works in the software "animation shop" they are well 120x60, so it is they remembered the actual size.
The Local Image Descriptor appears before each section of image data and has the following structure:
typedef struct _GifImageDescriptor
BYTE Separator; /* Image Descriptor identifier */
WORD Left; /* X position of image on the display */
WORD Top; /* Y position of image on the display */
WORD Width; /* Width of the image in pixels */
WORD Height; /* Height of the image in pixels */
BYTE Packed; /* Image and Color Table Data Information */
Separator contains the value 2Ch and denotes the beginning of the Image Descriptor data block.