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 >Hi everyone, > >I have photos, which have a transparent bg. Sometimes the objects are >rectangles sometimes they are not. > >Question is: >Setting an (imagined) x and a y-line, I would need to find out the >highest peak of non-transparent pixels within that picture, starting >from the lower right corner. The outcome should be the number of pixels >within the full picture: >x: 300 of 500 >y: 450 of 700 > >This data would have to be transported into a db. > >Any ideas? > _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
