It looks like the GIF decoder has a problem somewhere.
Using this as img.gif: http://upload.wikimedia.org/wikipedia/c ... imated.gif
When I run :
convert img.gif[0] frame0.gif
...and...
convert img.gif[1] frame1.gif
I get the correct images.
But when I run:
convert img.gif[2] frame2.gif
The output is corrupt. It looks like a lot of the pixels have been set to white for some reason.
I also see that problem in frame 6.
I'd assume it was a bad GIF, but Firefox, and IE and all the on-line GIF frame extractors I tried were able to show all the frames without any problem.
(I'm using the IM 6.8.8 on Windows)
Bug in GIF decoder
Re: Bug in GIF decoder
The frames of that gif image are optimized so each frame does not contain the exact version of that frame. If you want that you will have to -coalesce it first.
The delete operation first removes frames 0 and 1 and the second delete removes the frames from 1 till -1 (last image). This will allow you to get the second frame.
Edit (less code):
Code: Select all
convert Prague_Astronomical_Clock_animated.gif -coalesce -delete 0-1 -delete 1--1 test.gif
Edit (less code):
Code: Select all
convert img.gif -coalesce ( -clone 2 -write 2.gif ) null:
Last edited by dlemstra on 2014-04-10T12:59:02-07:00, edited 2 times in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bug in GIF decoder
If you want to look at all gif frames, then a simple variation of the above from dlemstra is
you will get images, test-0.gif test-1.gif ... test-N.gif
Code: Select all
convert Prague_Astronomical_Clock_animated.gif -coalesce +adjoin test.gif
Re: Bug in GIF decoder
ah. OK!
thanks.
thanks.