Copy link to clipboard
Copied
Hi,
I have a small AppleScript that used the Color Sampler Tool to place two color samples on an image. I am able to read back the (r,g,b) color values for these color samples, but the results in the script do not always match the info windows. It looks like Sample Size is always Point Sample when I read back the values in the script, even if the Sample Size is currently set to something like 11 x 11 Average.
I am running Photoshop CS3 Extended on a MacBook Pro. A copy of my script is attached to this post.
Does anyone know of a way to get the script to return the values using specific sample size settings?
Thank you
-- Bennett
Copy link to clipboard
Copied
In javascript a colorSampler only returns a single pixel no matter what the sample size is in the GUI. Sounds like it the same with applescript
Copy link to clipboard
Copied
Wow, that's too bad. Does anyone have a suggestion on how I can do the following then?
A. Determine what the current sample size is in the toolbar.
B. Compute the correct average values using a combination of the position information from the Color Sample and the sample size from A.
By the way, my eventual goal is to build this functionality into an Automation plug-in, so if you have ideas that are not possible in AppleScript but would work in C/C++ I would be interested in learning about those as well.
Thanks for your help.
Cheers
-- Bennett
Copy link to clipboard
Copied
I don't have CS3 so no Color Sampler for me. Nor do I know how to get "A" you can however get a Color Sample's 'position' and from there create a selection 3x3, 9x9, 11x11 around this point then read the histogram and calculate your average (all speculation BTW)
Copy link to clipboard
Copied
As you plan on making a plugin you may want to ask in the SDK forum.
As far as I know there is no access by script to tool options. You can make a selection of any size then apply the average filter to that selection, get the color from the histogram, then undo the filter
Find more inspiration, events, and resources on the new Adobe Community
Explore Now