Page 1 of 1

Posted: 2006-11-17T02:01:45-07:00
by anthony
If there is only one such area, you can do something like this...

Code: Select all

  convert  image.jpg  -matte  -fill none  -opacity white \
                 -fill white -colorize 100%  -trim   info:
to ouptut the minimal rectangle for that area.
This converts pure white into a shaped mask and thing -trim is used to locate that area.
Add a -fuzz factor if the white is not pure white. See
http://www.cit.gu.edu.au/~anthony/graph ... olor/#fuzz

If multiple areas are posible, then you will need to also generate that mask, but you will probably have to do something like a "-verbose -segment arg" to find them. I have not however played much with -segment, so I would love to know what you come up with.

Posted: 2006-11-19T18:44:18-07:00
by anthony
-opacity takes a color value. any color that is EXACTLY that color is replaved by the -fill color.

To also replace 'near' colors you need to add a -fuzz factor. See the link I gave above. The rest of the code is to basically invert the color selection so all colors which are not transparent are changed to white so that -trim can be used to locate the area of the original color.