The below gif's dimensions are 600*800. Height is 800 pixels, so there's a lot of blank space at the bottom I want to remove.
This was saved as old.gif
:
file old.gif
old.gif: GIF image data, version 89a, 600 x 800
Resized with convert command:
convert old.gif -coalesce temp.gif
convert -size 600x800 temp.gif -resize 600x400! new.gif
!
means ignore aspect ratio, do not keep aspect ratio unchanged.
Here's the result:
The new file new.gif
is deformed.
How can I resize the gif without deforming it?
My try with -crop
argument.
convert old.gif -crop 600x400+0+0 new.gif
How to remove the blank region in new.gif?
The blank white region is obvious in firefox.
convert old.gif -crop 600x400+0+0 new.gif
can't remove the blank white region in new.gif
.
Using the repage
argument will remove the blank white region, but it makes the gif more blurred.
convert old.gif -crop 600x400+0+0 -trim +repage new.gif
Use
!
after the resolution given to-crop
:From the imagemagick docs: