Programmatically determine the average greyscale

Sannyasin Brahmanathaswami brahma at hindu.org
Thu Feb 18 21:53:35 EST 2016


HH, thanks for the suggestion to use inks, though if it means the "label" will changes across all the buttons in the group, it may not be acceptable.  OTOH, perhaps for my audience it would be "interesting" I will try it. your other memo on use a field is an option as well, as fiddling with the margins of a button is a pain... and it changes depending on how long the label is... I think it may have been a bad decision... field will be better, but it was convenient to get started...

Agreed that the luminance value that one person will feel requires more contrast will vary across many different eyeballs. (smile)

But first, how to extract the color of a single pixel of an image??

BR


On February 18, 2016 at 1:25:00 PM, [-hh] (hh at livecode.org<mailto:hh at livecode.org>) wrote:

Hi BR (thanks for the abbreviation),

First you have to decide in detail what you want.

1. What is an average for you?
Usual arithmetic mean is one option, other simple ones are a weighted mean of rgb (used by Photoshop etc.) or median values.
2. How to use the alphavalues?
Max, min, median, weighted means are again options.

This is not at all trivial. The designers here will have extremely diverging examples for different 'averaging'.

Perhaps it is much easier (and much faster) to simply set the ink of the button to give a high contrast?

hh


More information about the use-livecode mailing list