If you set the PB measurement units to pixels (i.e. set .scalemode = 3), then its fairly straightforward. The properties .scaleheight and .scalewidth give you the height and width respectively of the PB in pixels. If your "specific area" is defined as a function of the total width and total height then just take the appropriate fraction. On the other hand, if your "specific area" is defined by, say, all the pixels whose red component is > 97, then loop through all the pixels in the PB using the .point function and count the ones which meet your criterion.
Note however that that will be a bit slow for lots of big pictures. Using API functions to set and get the bitmap bits associated with the PB is a lot faster.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.