PHP Classes

(Some) frame images have different size than the animated GIF

Recommend this page to a friend!

      Animated GIF into images  >  All threads  >  (Some) frame images have different...  >  (Un) Subscribe thread alerts  
Subject:(Some) frame images have different...
Summary:Problem working with frame images
Author:Patrick Walde
Date:2012-06-20 03:20:43
Update:2012-11-04 01:04:30

  1. (Some) frame images have different...   Reply   Report abuse  
Picture of Patrick Walde Patrick Walde - 2012-06-20 03:20:43
I played around a bit with this 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?

  2. Re: (Some) frame images have different...   Reply   Report abuse  
Picture of alex alex - 2012-10-30 23:48:06 - In reply to message 1 from Patrick Walde
Hello patrick

I have the same problem with GIFdecoder! This is because your gif is optimized.
if you re-register without optimization then it works.
but did you find a solution, for optimized gifs?

eg: with optimized gif ...

  3. Re: (Some) frame images have different...   Reply   Report abuse  
Picture of Patrick Walde Patrick Walde - 2012-11-02 01:46:03 - In reply to message 2 from alex
Hi 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.

  4. Re: (Some) frame images have different...   Reply   Report abuse  
Picture of alex 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
etc ...
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 idea with the top and left : ...

I found this link on gifs:

Local Image Descriptor

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.

and here : ...

Hoping that someone will be coded this part
thank you in advance.

For more information send a message to info at phpclasses dot org.