Cropping GIF produces 'animated' gif

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
vinaur

Cropping GIF produces 'animated' gif

Post by vinaur »

I have a single frame gif image (1000 pixels wide) and I want to crop it to get just the bottom 1000x60 pixel area.

First of all, this is the gif I start with:

Code: Select all

$ identify ABCA1.gif
ABCA1.gif GIF 1000x141 1000x141+0+0 8-bit PseudoClass 256c 9.33kb
I run the following command:

Code: Select all

$ convert ABCA1.gif -gravity South -crop 1000x60 +repage a.gif
The resulting image:

Code: Select all

$ identify a.gif
a.gif[0] GIF 1000x60 1000x60+0+0 8-bit PseudoClass 256c 9.97kb
a.gif[1] GIF 1000x60 1000x60+0+0 8-bit PseudoClass 256c 9.97kb
a.gif[2] GIF 1000x21 1000x60+0+0 8-bit PseudoClass 256c 9.97kb
My version information:

Code: Select all

$ convert -version
Version: ImageMagick 6.4.5 2009-06-04 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
Why in the world are there 3 frames? How do I get it to crop and create a single frame gif? (The image does not render using Windows Picture and Fax Viewer)

Thanks a lot!
rockcreekdan
Posts: 6
Joined: 2008-05-15T04:06:34-07:00

Re: Cropping GIF produces 'animated' gif

Post by rockcreekdan »

Specify the full geometry when you crop:

Code: Select all

$ convert ABCA1.gif -gravity South -crop 1000x60+0+0 +repage a.gif
My understanding is that without the +0+0 offset, crop basically splits the source into tiles of size 1000x60. Since your source image is 1000x141, it splits it into three tiles: two 1000x60, and one 1000x21.
vinaur

Re: Cropping GIF produces 'animated' gif

Post by vinaur »

Thank you!

That did the trick. :-)
Post Reply