Possible to Automate?

MW
Posted By
Michael_Wilking
Feb 28, 2004
Views
145
Replies
2
Status
Closed
Hi,
In Photoshop one can manually:
Open a graphic (say jpeg or gif, possibly png)
Click on the Eyedropper Tool
Select a point or area
Click on the foreground/background icon and obtain the RGB, hexa, HSB, etc values for the point/area selected.

Problem is, we need to do this for thousands, hundreds of thousands of images, for not necessarily the whole of the image(s) but a major part of it. (Some sort of sampling would work.)

Is there a way to automate this?

We have images of Fabrics and need to categorize them by color. So for example say we have a Fabric that has "Red" & "White" stripes. We need to classify that Fabric as "Red" and "White" so people can search the database for Red or White.
Certainly depending upon the lighting, the scanner, camera that created the image, any given "Reddish" pixel might have a slightly different value than the one (or group) next to it.

OK, so we set up a classification range, system that says in essence "if the RGB (or hexa, or HSB, or Lab, or whatever) value is between such and such and such then classify as "Red"

Ideally we would like to get a report of the analysis along these lines, a histograph (not drawn but the data):
255,000,000 occurred 30% of the time
102,051,204 occurred 20% of the time
etc. etc.

I realize PS cannot do the number crunching end (or can it?) so as to report frequencies, but can we automate the process?
A. It automatically reads in a file (as it does with say batch processing for format conversion) – as opposed to manually opening and selecting an image
B. select all or several pixels/areas – as opposed to manually selecting w the eyedropper tool
C. spit out a text file or such reporting the values it found – as opposed to user manually noting the values (on paper or typing into database)

We could then read in the text file to some sort of number crunching routine to come up with the "color(s)"

Alternatively, can anyone give me a hand in picking apart jpeg and/or gif files to read the color values for the pixels?

See this web page for barebones outline What is Blue? <http://www.blueorbwise.net/project1/whatisblue/index.html>

Thanks for the help.

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

CS
Carl_Stawicki
Feb 28, 2004
This can be done with an AppleScript. It’s very complicated, but possible, and I can explain it briefly. AS can access the histograms, and from there do some math to get the average values. It can work from all the pixels in the image, from a selection, or sampled color (whatever the foreground is set to). Unfortunately, working from selections or color samples would involve manual intervention. Selections could only be automated if each file had the exact same pixel dimensions, and you can get away with selecting the same area on every file. AS can also easily save any info to a text file (or to a database, but that’s over my head).

I would post this in the scripting forum if you want to explore it further.

Carl.
MW
Michael_Wilking
Feb 28, 2004
Hi Carl,

Thanks for the ideas.

Found this:
ImageJ <http://rsb.info.nih.gov/ij/index.html>
It is free.
Seems quite powerfull.
Does everything, has plug-ins do almost anything one would want.

Yet, it does not give a simple pixel by pixel listing of RGB values, or a frequency distribution, that I could find (which I could do, if I could get at the numbers to crunch, so no big deal).

But, going to see if I can get a plug-in going on my own – at least most of the work has been done, the tools for a plug-in are there.

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections