I want to remove all white pixel border (!) lines inside a picture around the actual content.
For that I enter the following command:
convert.exe -trim D:\tmp\2.jpg and got the following error (under 64bit Win7):
convert.exe: no images defined `D:\tmp\2.jpg' @ error/convert.c/ConvertImageCommand/3085.
Hmm, the picture exists!. Whats wrong?
Other related question: Assume I dont want not only to remove/trim pure white color lines but also almost white lines.
Lets say I want to remove lines whose "whiteness" is maximum 3% different from "pure" white.
How can I achieve this?
Ben
convert and trim problem
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert and trim problem
Your syntax is in error. Properly, you should open the input image before trimming or most any other operation.
convert image -fuzz 3% -trim +repage output
see
http://www.imagemagick.org/Usage/crop/#trim
Note the +repage (to remove the virtual canvas) is not needed for jpg output, but could be needed for gif, png and tif
convert image -fuzz 3% -trim +repage output
see
http://www.imagemagick.org/Usage/crop/#trim
Note the +repage (to remove the virtual canvas) is not needed for jpg output, but could be needed for gif, png and tif
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert and trim problem
To expand slightly on fmw's explanation: convert needs an input file and an output file. They can be the same name, but you must provide them both. So your command could be:
Code: Select all
convert D:\tmp\2.jpg -fuzz 3% -trim +repage D:\tmp\2.jpg
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: convert and trim problem
UNLESS you use "mogrify" that reads processes and writes images to the same file name, but (currently) only allowing 'simple' image operations. Note that -trim is a simple image operation.
Code: Select all
mogrify -fuzz 3% -trim +repage D:\tmp\2.jpg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/