13

I've got some scanned images in *.jpg format. They are scanned using A4 scanner, in greyscale or colour. Scanned pages have very different dimensions - some A5, some A6, some business cards etc. Scanner cover is white.

I want to trim all the white borders using imagemagick or graphicsmagick (those tools, because I want to further batch-process it). I understand that the border is scanned, so not perfecty white and that sometimes can cause trimming too much or too less of the image. However using trim parameter with fuzz I always get too big image. For example, using image of business card below:

gm.exe convert -crop -fuzz 50% 01-pixelated.jpg 01-pixelated-gm.jpg

produces image which is still not cut from the right and bottom. The result is the same no matter what number I put to the -fuzz parameter.

Could you please test it and advise the command line that will do the job?

enter image description here

3

1 Answer 1

12

In ImageMagick try this command:

convert input.jpg -fuzz 80% -trim +repage output.jpg

I tested it with ImageMagick 6.4.4 Q16 and, starting from the image you linked, I obtained this output image:

output

1
  • so obvious, I mismatched -trim with -crop. Thank you!
    – Arek
    Nov 19, 2013 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .