Sorry but this doesn't really work
![Geek :geek:](./images/smilies/icon_e_geek.gif)
:
* Create a 2x2 pixel image with a diagonal of red and one of green.
* Use it as a pattern to fill half of an image.
* Get the average color of that part, you get (.5,.5,0) or (127.5,127.5,0) on a 0..255 scale
* Fill the other half of the image with (127,127,0) or (128,128,0) and you will see that this is much darker than the red/green pattern.
This is our old gamma-correction friend at play... If you still have Gimp 2.8 around make a red/green gradient and you will see that the middle of the gradient, instead of being yellow, is quite brown (and is indeed (127,127,0)). This is something that has been fixed by moving to "linear light" pressing in 2.10.
For correct values:
* Gamma is 2.24
* 1/Gamma is 0.4464,
* 0.5^0.4464=0.734 (187 on a 0..255 scale)
* Now fill the other half with (187,187,0) and you will see it is much closer to the red/green pattern (how much closer depends a bit on your display setting/viewing software, it is near perfect on the laptop screen (Gimp, Gwenview and Firefox) a bit less so on my big (uncalibrated) display.
See attachment for your own testing (but check only the 100% image, at smaller scales, the scaling interpolation will do the same mistakes(*)...). You can so the same with a black and white checkerboard pattern and you will find that the average gray is indeed (187,187,187).
Of course, if you have "continuous" colors, especially in a limited range, the average from the script is a bit closer to the correct value, and evaluating what should be the equivalent color is not as obvious anyway.
(*) On Gimp 2.8, scaling the text image to 400x400 makes the grid half the same color as the (127,127,0) part. Doing the same on 2.10 correctly keeps the grid half the same color as (187,187,0).