Page 1 of 1

How to detect a custom border (rectangle) inside an image?

Posted: 2017-02-28T02:46:26-07:00
by rayern
I have an image in which there is a rectangle with custom border (anyhow I want). There is an image drawn inside the rectangle.I need to crop the outer image to the rectangle border.So I need to detect the rectangle border inside the image.Any ideas how do I do that? I've looked at 'Imagick' but I cant seem to find out a solution. Any help would be appreciated

I want to then crop the image inside the rectangle.

Re: How to detect a custom border (rectangle) inside an image?

Posted: 2017-02-28T03:32:54-07:00
by Bonzo
I would suggest you upload an image somewhere and share a link here.

Also what version of Imagemagick you are using along with your preferred code - you want to use Imagick?

Re: How to detect a custom border (rectangle) inside an image?

Posted: 2017-03-01T22:26:36-07:00
by snibgo
If your custom border is visually distinctive, this is possible. For example, the border contains a distinctive colour such as pure red that does not occur elsewhere. Then you can simply turn all non-red pixels white, and "trim" gives the location of the border.

The same principle applies to any distinctive marking.

I'm moving this to the Users forum.