Login   Register  
PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

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

  1. (Some) frame images have different size than the animated GIF   Reply   Report abuse  
Picture of Patrick Walde
Patrick Walde
2012-06-20 03:20:43
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?

  2. Re: (Some) frame images have different size than the animated GI   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
http://imageshack.us/a/img839/6453/capture1td.png

  3. Re: (Some) frame images have different size than the animated GI   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 size than the animated GI   Reply   Report abuse  
Picture of alex
alex
2012-11-04 01:04:30 - In reply to message 3 from Patrick Walde
Hi,
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.

http://img12.imageshack.us/img12/7286/exploreas.png

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 :
http://img10.imageshack.us/img10/1368/framef.png


I found this link on gifs:
http://www.fileformat.info/format/gif/egff.htm


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 */
} GIFIMGDESC;

Separator contains the value 2Ch and denotes the beginning of the Image Descriptor data block.


and here :
http://www.php.net/manual/de/function.imagecreatefromgif.php ...

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