Hi,
I want to automate scanning and trimming a bunch of documents. I am hoping to use sane to scan and then imagemagick to post process.
I'm scanning on a brother ADS-2100e
When I scan, the scanner puts grey borders down the side of the image and a white border at the bottom of the image like these:
https://flic.kr/p/JZVdPu
https://flic.kr/p/JTKcvu
I've not been very successful with using the trim command to trim off those borders. I've even tried adding a white border around the whole image and then trimming that off, and then adding a grey border and trimming that off with a fuzz level but I always seem to end up with a white bar at the bottom that prevents the grey being trimmed off.
Result of: mogrify -trim +repage *.pnm
https://flic.kr/p/K2CcGS
https://flic.kr/p/J9gZcp
Any suggestions for the best approach to this? I'm looking for something that is automatic and can cope with differences from scan to scan so I don't have to look at each scan.
What about if I try and replace the grey and white with a known odd colour, then trim that colour?
suggestions on trimming scanner output
-
- Posts: 2
- Joined: 2016-07-12T19:50:56-07:00
- Authentication code: 1151
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: suggestions on trimming scanner output
Try using -fuzz XX% -trim (multiple times), such as
This gets you down to the base image which shows some slight rotation.
In the future, please provide your IM version and platform.
See the top-most post in this forum IMPORTANT: Please Read This FIRST Before Posting
Code: Select all
convert 28152554082_0ce150132b_o.png -fuzz 25% -trim -trim result.png
In the future, please provide your IM version and platform.
See the top-most post in this forum IMPORTANT: Please Read This FIRST Before Posting
-
- Posts: 2
- Joined: 2016-07-12T19:50:56-07:00
- Authentication code: 1151
Re: suggestions on trimming scanner output
Appologies, here they are somewhat late.
Debian Jessie GNU/Linux
ImageMagick 6.8.9-9 Q16 x86_64 2016-06-01 http://www.imagemagick.org
Thanks for your example, that seems to work well.
Debian Jessie GNU/Linux
ImageMagick 6.8.9-9 Q16 x86_64 2016-06-01 http://www.imagemagick.org
Thanks for your example, that seems to work well.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: suggestions on trimming scanner output
The reason for the version information is that syntax may differ for Unix and Windows systems and for scripting