Hello girls and guys,
I already searched a lot on the internet but I just can't find a solution for this.
I have a picture with background (which needs to be removed) - the background is inhomogeneous, i.e. not of the same color etc.
Inside the picture, there is my wanted content. A border with a color I specified defines the surrounding.
How may I crop it? I tried something with txt to find the color, but I'm on windows and can't use grep. Also, it's very slow.
An example (note: the border in reality is 1px exact and same color anywhere):
Any help and ideas are appreciated!!
Flo
Crop/Trim picture by specific border inside picture
-
- Posts: 2
- Joined: 2011-12-01T03:28:25-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Crop/Trim picture by specific border inside picture
try a fuzzy floodfill from each corner to get a constant color around the center area. Then use -trim +repage.
see
http://www.imagemagick.org/Usage/draw/#color
http://www.imagemagick.org/Usage/crop/#trim
see
http://www.imagemagick.org/Usage/draw/#color
http://www.imagemagick.org/Usage/crop/#trim
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Crop/Trim picture by specific border inside picture
The other way is to generate a mask of the dividing color. A trim of that mask will then get you the bound by which you can crop the original.
Something similar to this is done (using blur rather than a mask) in
Trimming 'Noisy' Images
http://www.imagemagick.org/Usage/crop/#trim_noisy
Just generate the bounds mask instead of the blurred image.
Something similar to this is done (using blur rather than a mask) in
Trimming 'Noisy' Images
http://www.imagemagick.org/Usage/crop/#trim_noisy
Just generate the bounds mask instead of the blurred image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 2
- Joined: 2011-12-01T03:28:25-07:00
- Authentication code: 8675308
Re: Crop/Trim picture by specific border inside picture
Insane! Works like a charm!
I am very thankful for the tip. My solution is just straight forward, I use filltoborder with my specified border color, then trim and repage.
Thank you very much! May the force be with both of you
I am very thankful for the tip. My solution is just straight forward, I use filltoborder with my specified border color, then trim and repage.
Thank you very much! May the force be with both of you