I've done some testing with the -trim option with self created files (Fireworks) and it seemed to work ok but when I try to trim my scanned images the border does not disappear.
I use (from the windows command prompt) the following command:
convert -trim input.jpg output.jpg
Please ask me for an example file if you want to test it
trim does not remove the black border from JPEG
Re: trim does not remove the black border from JPEG
I have never used trim but try adding +repage
Code: Select all
convert input.jpg -trim +repage output.jpg
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: trim does not remove the black border from JPEG
A scanned image probably doesn't have a border with a pure colour. Add -fuzz 20 to your command and see how much it trims off. Then play with the fuzz value to get the right amount trimmed off.
See: http://imagemagick.org/script/command-l ... s.php#fuzz
Pete
See: http://imagemagick.org/script/command-l ... s.php#fuzz
Pete
Re: trim does not remove the black border from JPEG
Sorry to tell that both of your solutions do not work.
If you want to test is yourself, please tell me where to send some test images ...
If you want to test is yourself, please tell me where to send some test images ...
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: trim does not remove the black border from JPEG
+repage does not work for JPEG, as this file format does not use virtual canvas information. PNG does but only partially, GIF definably does.
The problem is JPG is lossy. Colors are not EXACTLY as you thing they are.
As such to trim you need to tell IM to allow 'near' colors too. To do this add a 'fuzz factor.
See IM Examples, Fuzz Factor...
http://www.imagemagick.org/Usage/color/#fuzz
The problem is JPG is lossy. Colors are not EXACTLY as you thing they are.
As such to trim you need to tell IM to allow 'near' colors too. To do this add a 'fuzz factor.
Code: Select all
-fuzz 1% -trim
http://www.imagemagick.org/Usage/color/#fuzz
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/