Using slow satellite connection and need to crop white space around scanned image. Image is not always in right position (can be rotated a bit) and size is different.
I need to find first non white pixel from the edge from all 4 sides. Then crop image.
Is there direct function for it or I need to play around.
Thank you for help.
How to crop immage to first non white pixel from edges
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to crop immage to first non white pixel from edges
There is no direct function for this. I show a method on my "Inner trim" page, including a Windows BAT script.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to crop immage to first non white pixel from edges
Are you trying to remove the outer white area? If so, then try -trim. See http://www.imagemagick.org/Usage/crop/#trim
You can also unrotate the image using -deskew (before trimming), if the rotation is less than about 5 deg. See http://www.imagemagick.org/script/comma ... php#deskew. If on a Unix-type platform, you can try my script, unrotate at my link below.
Please always provide your IM version and platform, since syntax may differ. An example image always helps, too.
You can also unrotate the image using -deskew (before trimming), if the rotation is less than about 5 deg. See http://www.imagemagick.org/script/comma ... php#deskew. If on a Unix-type platform, you can try my script, unrotate at my link below.
Please always provide your IM version and platform, since syntax may differ. An example image always helps, too.