5
\$\begingroup\$

How to calculate mean/average photo color in GIMP?

I have some photo and want to calculate average color - how can I do it?

\$\endgroup\$
0

4 Answers 4

11
\$\begingroup\$

Actually it's very simple. If you open the Histogram tab, there are some basic statistics about the color values, such as mean, standard deviation and median.

I've included some of the surroundings for context.

Depending on the selected tab (RGB, Red, Green, Blue, Value) you'll get different statistics. If you want to know the average color, take the Mean from the three separate channel histograms and enter them in a color picker. You have one by clicking on the colored rectangle in the toolbar.

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ note that it also adapt to the current selection. Very convenient ! \$\endgroup\$ Commented Dec 26, 2015 at 0:03
  • 1
    \$\begingroup\$ In GIMP 2.10.22, the Histogram tool shows small decimal numbers for the Mead, Median, Std Dev. In the color picker, I had to multiply by 10. \$\endgroup\$ Commented Aug 10, 2021 at 18:27
7
\$\begingroup\$

Resize the image to 1x1 and see the color of the pixel you get. :)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I compared the color obtained with this method vs. @clabacchio's answer to use the Histogram toolbox. The results were very similar #373983 vs #363b85 . YMMV: My source image was 177x177 of random blue pixels. I scaled the image to 1x1 with no interpolation. \$\endgroup\$ Commented Aug 10, 2021 at 18:32
2
\$\begingroup\$

Since most of all images are shown either in RGB or CMYK mode, calculating an average color value from there is difficult because you have 3 or 4 values per pixel. I would try to convert the image into HSV mode (Hue, Saturation, Value). There you have one specific color value for each pixel which is easier to calculate. See also here: Wikipedia Link HSL and HSV

I am not sure whether there is an option in Gimp to convert your file to this color space. I would try it with Matlab or maybe Octave (free).

\$\endgroup\$
3
  • \$\begingroup\$ HSL/HSV space is not good for color processing - much better is CIE Lab or sRGB. More popular is sRGB. HSL is good for artists. \$\endgroup\$
    – Chameleon
    Commented Oct 27, 2014 at 15:43
  • 2
    \$\begingroup\$ Can you give some reasons why it is bad if you only use it for the purpose of calculating the average color ? I thought HSV is useful in industrial image processing since you have direct access to every color with one single value. Maybe I´m missing something. \$\endgroup\$
    – koocky
    Commented Oct 27, 2014 at 20:24
  • 1
    \$\begingroup\$ Old thread, but to answer the question of why averaging in HSB/HSV is not useful, how do you take the average of the hues 0° and 180°? There's no meaningful answer. Whereas if you take the average in an RGB space of #FF0000 and #00FFFF it's clear that the answer is #7F7F7F. \$\endgroup\$
    – GKFX
    Commented Jun 23, 2020 at 16:38
2
\$\begingroup\$

Want something like this ,just figured by chance that you can use (linux only)GPick

go to tools -> Palette From Image ... -> pick the image and set number of colors to one this will give you the exact color if you try @clabacchio solution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.