Programmatically determine the average greyscale

-hh hh at livecode.org
Thu Feb 18 19:46:58 EST 2016


BR,

I now saw, late -- sorry, that you are using button's showName, that is, the text colour has to be adjusted, not the pattern.

Then using a text field instead of 'showName' and setting the field's ink to "notSrcAndReverse" should do what you want (incl. nice effects).


OR:

Here's a formula for a weighted mean close to that some professional apps use when converting an image to grayLevel.

This is derived from "perception" values (note: .6 is close to goldenRatio) of the human eye:

## g = (1*r + 6*g + 3*b) div 10 for each r,g,b-pixel
used for fully opaque pixels.

hh



More information about the use-livecode mailing list