What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Export grayscale values


Counting Colors

New Member
Messages
3
Likes
0
Hello
I am looking for a way to export the number of individual grayscale values in an image.
In the histogram it is displayed graphically. How do I get all these values into a text file or a spreadsheet?
In the measurement protocol I only see the minimum, maximum and average value.
But I need a list with all single gray levels. How often is the value with gray level 1, 2, 3, 4 etc. included.
For example, if I have an 8-bit grayscale image, it will contain values from 0 to 100, but I am interested in how often each value occurs.

For the sake of simplicity, I have only mentioned grayscale here, but in a RGB, CMYK, LAB or multi-channel image, the individual channels are also only grayscale.

BR. Oliver
 
Hi @Counting Colors
The most productive way to do this would be a PS script.
A script expert on the forum might respond with an option yet a quick look on the internet there were a number of scripts to do this (I have not downloaded them to confirm the functionality).
Here is a link to just one that came up for me.
Thought this would be worth mentioning, yet if trying scripts is not your thing, another forum member may have some other alternatives
John Wheeler

https://community.adobe.com/t5/phot...nt-histograms-from-activedocument/m-p/2828015
 
Hello John Weehler,

thank you very much for your support.
Unfortunately I have no idea about scripting. What do I have to do to get the script to run and how does it show me the values afterwards or how can I export them.
 
Hi @Counting Colors
Well there is bad news and there is good news.
The bad news is that there is a feature in Photoshop (newer since that last time I looked) of which I was not aware.
The good news is that it is very easy now to extract a CSV file from any selection of an image for the count of pixels at any given gray level for each color channel.

All you have to do is make a select the whole image and run the measurement tool (Image > Analysis > Record Measurements
All sorts of data is recorded and at the very end of the list is "histogram"

Instead of describing the details, here is a snippet from the help file as well as a link to the help file:

Histogram
Generates histogram data for each channel in the image (three for RGB images, four for CMYK, and so on), recording the number of pixels at each value from 0 to 255 (16‑bit or 32‑bit values are converted to 8‑bit). When you export data from the Measurement Log, the numeric histogram data is exported to a CSV (comma-separated value) file. The file is placed in its own folder at the same location where the measurement log tab-delimited text file is exported. Histogram files are assigned a unique number, starting at 0, and progressing by 1. For multiple selections measured at once, one histogram file is generated for the total selected area, plus additional histogram files for each selection.

Here is the link to the help file: https://helpx.adobe.com/photoshop/u...nalysis > Ruler Tool,count items in the image.

From the measurement panel you can save the measurements to a file on your compurter and it comes in two parts, a Text file with most of the measurements and then a folder with a CSV file for each set for every measurement you have taken.

So just goes to show, not matter how long I work with PS, I am continually learning about its features.
I am sure this will provided what you need and if you need more help on how to use it just ask away
John Wheeler
 
You are very welcome BR Oliver aka @Counting Colors
I learned something new as well in searching for a solution and am using it already myself as well including histograms of luminosity of the overall RGB channels and more :D
So mutually beneficial!
John Wheeler
 

Back
Top