detect border of image

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
vladimircape
Posts: 7
Joined: 2014-07-09T06:15:04-07:00
Authentication code: 6789

detect border of image

Post by vladimircape »

I have images, all of them have borders.
borders from left,right,top,bottom size.
And border is simple or is just solid color,
or reflection of part of picture
for example reflection, from the left, it's part of picture 30px from left side of picture
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: detect border of image

Post by Bonzo »

You could -trim the image and see if the size changes that would detect the solid colour. If it does not change it must be some other type of border
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: detect border of image

Post by fmw42 »

Please always provide your IM version and platform, since syntax differs. Also can you post a couple of your images so we can see what type of borders you have and to experiment with solutions. You can post to some free hosting such as dropbox.com and put the URL here.

Please read the top-most topic in this forum at viewtopic.php?f=1&t=9620

Detecting a constant color is likely pretty simple, but a reflection will be much harder.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: detect border of image

Post by snibgo »

As Fred says, samples would help.

Perhaps all the borders are characterised by a sharp transition that runs most or all the way across the image, so an edge detector might find them.
snibgo's IM pages: im.snibgo.com
Post Reply