Hello,
I can't trim a GIF image, the canvas remains 40x32 pixels. As a
result, all browsers show the image with 40x32 pixels.
What I did:
wget http://www.doppelbauer.name/test-40x32.gif
convert -trim +page test-40x32.gif /tmp/test.gif
identify /tmp/test.gif
Result:
test.gif GIF 30x28 40x32+0+4 8-bit PseudoClass 64c 7.8e+02b
Thanks
Marcus
Trim gif image
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Trim gif image
You have hit a legacy option handling bug.
http://www.imagemagick.org/Usage/basics/#legacy
Read your image BEFORE trying to apply operations to it!
http://www.imagemagick.org/Usage/basics/#legacy
Read your image BEFORE trying to apply operations to it!
Code: Select all
convert test-40x32.gif -trim +repage /tmp/test.gif
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Trim gif image
Hi Anthony,
Thank you very much for your answer.
But it does not work:
All browsers show the GIF 40x32 pixels, but not trimed.
Thanks
Marcus
Thank you very much for your answer.
But it does not work:
Code: Select all
wget http://www.doppelbauer.name/test-40x32.gif
convert smiley-monksmile-40x32.gif -trim +page test.gif
Code: Select all
identify test.gif
test.gif GIF 30x28 40x32+0+4 8-bit PseudoClass 64c 7.8e+02b
Thanks
Marcus
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trim gif image
without seeing your image, it is hard to tell what is going on. can you post a link to an example of your images that do not trim.
if your image does not have a constant color along any given edge and inward, it will not trim. you need to add -fuzz to handle close colors.
see http://www.imagemagick.org/script/comma ... s.php#trim
also see http://www.imagemagick.org/Usage/crop/#trim
I believe to remove the virtual canvas, you need to add +repage per the above (not sure about +page)
if your image does not have a constant color along any given edge and inward, it will not trim. you need to add -fuzz to handle close colors.
see http://www.imagemagick.org/script/comma ... s.php#trim
also see http://www.imagemagick.org/Usage/crop/#trim
I believe to remove the virtual canvas, you need to add +repage per the above (not sure about +page)
Re: Trim gif image
Hi fmw42,
Thank you very much for your answer.
I have added an example, here again the link:
http://www.doppelbauer.name/test-40x32.gif
Thanks!
Marcus
Thank you very much for your answer.
I have added an example, here again the link:
http://www.doppelbauer.name/test-40x32.gif
Thanks!
Marcus
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trim gif image
Your image has an alpha channel. So you have to enable that before trimming. try this.
convert test-40x32.gif -channel rgba -alpha on -trim +repage test-40x32_trim.gif
convert test-40x32.gif -channel rgba -alpha on -trim +repage test-40x32_trim.gif
Re: Trim gif image
Hi fmw42,
Thank you very much!
It works!
Marcus
Thank you very much!
It works!
Marcus
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trim gif image
I stand corrected by Anthony, who says, the important thing is just the +repage. So this works fine for me
convert test-40x32.gif -trim +repage test-40x32_trim.gif
convert test-40x32.gif -trim +repage test-40x32_trim.gif