How do I auto-crop white pixel line borders of a picture?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bensto

How do I auto-crop white pixel line borders of a picture?

Post by bensto »

I want to pass a picture to ImageMagick and let the program auto-crop borders.
IM should anlyze from the borders (top,bottom,left,right) if athe last pixel line (row or column)
contains only white (or almost/close-to-white) pixels.
If so IM should remove this line (crop the picture).
This should be repeated until at least one -non-white pixel appears in the last pixel line.

How can I achieve this (with which options)?

Ben
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I auto-crop white pixel line borders of a picture?

Post by fmw42 »

You can also try using my script autotrim. It uses a slightly different approach, but the end result is similar. You can get it at http://www.fmwconcepts.com/imagemagick/index.html
bensto

Re: How do I auto-crop white pixel line borders of a picture?

Post by bensto »

fmw42 wrote:You can also try using my script autotrim. It uses a slightly different approach, but the end result is similar. You can get it at http://www.fmwconcepts.com/imagemagick/index.html
Sorry, could not download your script form page

http://www.fmwconcepts.com/imagemagick/ ... /index.php

Maybe the link is broken.

Could you verify this?

Ben
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I auto-crop white pixel line borders of a picture?

Post by fmw42 »

The link goes to a script that allows me to count downloads. So do not try to right click to get a menu to download. Simply left click the link and it should download automatically. Perhaps it is downloading but you do not know where your default download is going. Anyway, if that does not work, email me directly at fmw at alink.net and I will email you a copy directly. I have other reports that they could not download and I am not sure what the problem might be. So if you cannot get it to work and email me, please let me know what you are doing and on what platform and browser.

Fred
Post Reply