How do I identify border around the image?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I identify border around the image?

Post by fmw42 »

developer wrote:I need to be able to find a border around the image. The border can be either of the same color or shaded.
I am not sure I understand what you are asking!

I don't think IM can just tell you directly if/where a border is located and how big it is.

But you can extract a mask image that might contain just the border.

try -fuzz XX% -threshold XX%

see
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/quantize/#threshold

That will create a binary image that might show the border only. This mask can be used for further processing.

If you want to ADD or REMOVE a known size border see
http://www.imagemagick.org/Usage/crop/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How do I identify border around the image?

Post by anthony »

Also look at using -fuzz and -trim
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply