On Sun, 27 Sep 2009 17:39:17 -0700
Fred Weinhaus <[email protected]> wrote:
|
| Just curious, but is this the bounding box and if so, then the top
| left corner might not be opaque.
|
Yes the top left corner may not be opaque, BUT it does find the
first and last rows with a non-opaque pixels.
| Might it be better to extract the alpha channel and search the top
| row for any non transparent pixels. continue with the next row if the
| top row is fully transparent, etc.
|
The other way to find the FIRST non-transparent pixel would be
to just write the alpha channel as a TXT image file, and grep for
the first non-black pixel (ignoring the first line)
convert image -alpha extract txt:- | sed -n '1d;/black/!{p;q;}'
I do something like this in the script "segment_image"
http://www.imagemagick.org/Usage/scripts/segment_image
| >Fast way... extract the alpha channel, trim, and report the results virtual
| >canvas!
| >
| > convert image -alpha extract -trim -format '%wx%h%O' info:
| >
| >This give you the size, and top left corner offset of the non-transparent
| >parts of the image.
|
Anthony Thyssen ( System Programmer ) <[email protected]>
-----------------------------------------------------------------------------
UFO Kite: a radiply spinning motor at the end of a kite line.
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users