stil / gif-endec

PHP GIF encoder and decoder
63 stars 16 forks source link

Static on separated images #1

Closed moinism closed 9 years ago

moinism commented 9 years ago

It is creating some really distorted images on few gifs. Try converting this one: fresh

While if we convert it using https://github.com/Sybio/GifFrameExtractor than there is no problem.

stil commented 9 years ago

In fact, those frames include transparency: frame

Usually first frame "looks normal". You need to overlay this first frame with following semi-transparent frames. This method of animation saves file size.

Your original GIF image is:

But if you saved it without transparency, it would be

However I'll fix it, by setting it default to decode such GIFs, so separate frames look "normal".

Edit: In the animation below you can see transition between first and second frame. (2nd one is overlayed over first frame).

fade

stil commented 9 years ago

Does it https://github.com/stil/gif-endec/blob/master/README.md#render-animated-gifs-frames-with-transparency solve your problem?

moinism commented 9 years ago

Yep, now it works on almost all the gifs with transparency. Just this one is still same as previous results:

iphone

First three frames are 'normal' and then same thing. Try it please. Also, your script uses tremendously less amount of memory and time as compared to the other script. P.S: you rock! :+1:

stil commented 9 years ago

You're right, this GIF has frames with different sizes. I added few commits which should solve this issue. Check it out now.

moinism commented 9 years ago

Awesome, its working great now. Really Nice work.