Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unexpected behavior with Color Sampler Tool

New Here ,
Jun 09, 2009 Jun 09, 2009

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


TOPICS
Actions and scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Jun 09, 2009 Jun 09, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2009 Jun 09, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 09, 2009 Jun 09, 2009

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 09, 2009 Jun 09, 2009
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines