On Thu, 24 Sep 2009 15:06:44 -0700 Fred Weinhaus <[email protected]> wrote:
| 1) extract the alpha channel (presumably as a binary image) white as | opaque and black as transparent | | convert image -alpha extract alphachannel.png | | 2) in a loop extract each column (see subsectioning | [1xheight+xoffset+0] or -crop ... +repage) and sequence down the | column (y increases downward in pixels) until you find the first | pixel that is white -- that will be the highest (closest to the top) | non-transparent pixel in the column. | | 3) repeat for each column | | 4) compare the results from each column to find the one that is closest to y=0 | 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]> ----------------------------------------------------------------------------- Oh they never lie. They dissemble, evade, prevericate, confound, confuse, distract, obsure, subtly mis-represent, and wilfully misunderstand..., but they never lie. Perish The thought. - about Mind Ships of Culture -- Iain M. Banks, "Look to Windward" ----------------------------------------------------------------------------- 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
