Calculate percentage of colors in image

Hi there! I’m trying to find a working and accurate way to calculate how much of specific colors are in a picture. Be it percents or just numbers. At this point I can’t use photoshop but maybe there’s other ways avaiable that you know of? Thanks in advance. BTW, geotests dot net is not accurate enough

What is geotests?

Acrobat can read colour separations.

will try acrobat, even though adobe products don’t seem to work on my machine

I think you need to better describe what you are wanting to do with the color. It doesn’t sound like you are looking for color seps. Or are you looking for ink percentages, not color percentages?

Hi!

For example, I’ve got an image with a red circle and a green one. The red circle is bigger. I want the software to tell me that there’s more red in the picture than there’s green. Hope that explains it better

thanks in advance

Yes it does read the separations but I can’t figure out why it gives zero percent to all the colours. I need to know what color dominates in the picture

In a 16-bit color image, 65,536 colors are possible. In a 3000 x 3000-pixel image, for example, there are 9,000,000 pixels.

A simple image with a red circle on a black background might appear to be only two colors, but both the red and black areas will likely be composed of tens or hundreds of thousands of adjacent pixels of slightly different colors.

For example, in hexadecimal notation, the red displayed by a pixel might be dc3f15. The adjacent pixel might be dc3f16. Those are two separate colors, but the two colors are indistinguishable to the human eye.

You stated, “I’m trying to find a working and accurate way to calculate how much of specific colors are in a picture.” If I take your statement literally, you’re asking which of those 65,000 possible colors appears more often than the others. In the 3000 x 3000-pixel image I mentioned, for example, 3987 of those pixels might be dc3f15, and 3892 might be the indistinguishable-to-the-human-eye color dcef16.

Red, blue, purple, yellow, or green aren’t specific — they’re subjective ranges of colors, hues, tints, shades, intensities, etc., in the spectrum of millions of possible variations

In other words, an objective, definitive answer to your question about which color appears most often might be the reddish dc3f15. However, a subjective answer to your question might be that there’s more blue in the photo than red.

Color is complicated, and I don’t know of any software application that will provide a meaningful answer to the rather vague question you’ve asked.

This onlline tool tells you the dominant colours

Is it a good idea to be using online software from Ukraine right now?

why would it be a bad idea?

the tool that kind of does what I want is geotests (sorry but the forum does not allow links, just put geotests in google and press the second given link), but sometimes it gives weird, obviously wrong results

This is a bit difficult to explain because it’s conceptually confusing.

Unfortunately, you’re looking for a straightforward solution that doesn’t exist and can’t exist without, first, defining the parameters you want the algorithm to consider.

Going back to my first response, in a 16-bit image, there are 65,536 possible colors. Both the sites that Smurf2 linked to and the one you mentioned (geotests.net) depend on various algorithms to determine outcome values that are based on medians, averages, color thresholds, pixel cluster samplings, etc., of all those possible colors. Depending on how these and other parameters are used, determines how the result is calculated.

Here’s a simple example of why different answers are equally valid depending on which parameters are used.

In the image below, you might say blue is used more than any other color because there is far more blue than purple.

However, all those blue colors consist of thousands of variations of blue — each having its own hexadecimal number. Each of those variations of the blue gradient consists of ~960 pixels of any specific blue. However, the small purple square contains 3480 pixels of a specific purple: hex # 7546b6.

In other words, you might say purple (7546b6) is the main color because that specific color outnumbers any of the specific blue colors.

Depending on the variable used (e.g., how the question is asked), either purple or blue could be the correct answer.

The website Smurf2 linked to uses its own predefined set of parameters in the algorithm. The geotests.net site lets the user determine some of the parameters. If the algorithms are written correctly, they will provide accurate answers, but those answers, by necessity, must be obtained by using the various parameters the algorithm considers.

Thanks a lot you for your responses! There’s one improtant detail about what I’m looking for - the input material that I’m going to work with will only contain 5 colors, so I guess I need to figure out what the settings on geotests do try to stick to that software.

thanks again

Here same issue. I need a proper way to calculate percentage the amount of each colours within an specific area/artwork. Ideally within illustrator where I select the artwork that I want to measure (colour shapes=color areas) and I get the amount of each colour within the artwork selected.
For example, If I have a 10x10cm of a black square filled shape and in the center of it theres a red filled circle, I need the exact amount of red in % as well as black within that area. Is it any possible?

Cant understand why such a basic feature is not straightforward within Illustrator, if considered at all. since I find so hard to achieve this basic stuff.

Any idea?

If you are using Illustrator and working with Vector Shapes within Illustrator, what you are asking can be done using a plug-in called CadTools from HotDoor. It gives you the area of the shapes and you do the math.

If you are looking for something more intricate, I guess it depends on what your end goal is. Why do you need to know these area numbers?
(note if it’s for calculation of material for cut vinyl, that doesn’t work that simply… Just sayin’)

Thanks for your response.
I usea cadtools regularly and “calculating the area of a shape” as you propose is not the solution, I need the percentage of colour given the area that it has, Individually per colour and total.
I still do not understand how something like colour percentages are not even considered for a feature.

I work with colours areas and reflectance values from colour shapes so I am absolutely restricted when I need to calculate the value of certain colours/shapes depending their area. Basically I am limited to regular shapes just because theres no way possible for me to calculate % of colour per area…its so frustrating how such a basic feature is not even considered…

So no, Cad tools is not an option for obvious reasons.

The reason isn’t really obvious. What is your end product? Graphic art or data points?

I’m confused about what you’re asking.

Let me reword what I think you’re asking, then tell us if that’s it.

Using your square black shape with a red circle shape in the middle as an example, are you asking if there’s a feature in Illustrator that will enable you to tell how much of that given area (in percentages) is occupied by black and how much is occupied by red? For example, 80% of that total area is red and 20% of that area is red.

Or perhaps you’re asking if there’s something like a lasso tool that you can draw around an area to find how much area the shapes and their colors occupy within the lassoed area.

If so, I know of no way to do this in Illustrator. I’m not even sure how it could be done in Illustrator without rasterizing and flattening the file before taking the measurement. I suppose it could be done, but despite you needing this feature, I doubt the feature would be useful to many others, so I doubt it’s on Adobe’s to-do list.

Years ago, there was a plugin called Patharea that would calculate areas of paths, but I don’t remember the details. However, that doesn’t sound like what you need either.

Then again, as I said, I’m not entirely sure what you’re asking.
__

Follow-up: I did a quick Google search for Patharea to see if it was still made and ran into this series of posts on the Adobe community site that might be useful.

Both of those can be done with CadTools, which the poster says they have, so I doubt that’s the issue here. Though both would require doing math. I have a feeling the ‘art’ in question is not as simple as a circle in a box.
In the two images below, the red circle is 20.2% of the black box area.

Screenshot 2023-09-19 at 10.14.03 AM

Screenshot 2023-09-19 at 10.13.46 AM

I could do the same thing with the blob tool to make a shape over an image and CadTracker would give me the area of that shape too.

I’ve used a tool called “Image Color Summarizer” before. It’s a web tool that gives you a breakdown of colors in your image.

1 Like