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

How to add a color sampler through Photoshop Scripting?

Participant ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Hi,

     I would like to fix a color sampler point through Photoshop Scripting?

Could you please help me on this.

thanks,

rajiv.s

TOPICS
Actions and scripting

Views

3.2K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , May 02, 2012 May 02, 2012

var theSampler = app.activeDocument.colorSamplers.add([10,10]);

alert (theSampler.color.rgb.red+"_"+theSampler.color.rgb.green+"_"+theSampler.color.rgb.blue);

Edit: And keep in mind that a document can have only four ColorSamplers (as of CS5 at least).

Votes

Translate

Translate
Adobe
Community Expert ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

var theSampler = app.activeDocument.colorSamplers.add([10,10]);

alert (theSampler.color.rgb.red+"_"+theSampler.color.rgb.green+"_"+theSampler.color.rgb.blue);

Edit: And keep in mind that a document can have only four ColorSamplers (as of CS5 at least).

Votes

Translate

Translate

Report

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
Community Expert ,
May 12, 2012 May 12, 2012

Copy link to clipboard

Copied

You can also remove the color samplers so that you can keep taking readings.  I've done this to create an XML file of various sample points to be used later by another script.

Votes

Translate

Translate

Report

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 ,
Mar 01, 2013 Mar 01, 2013

Copy link to clipboard

Copied

Hi

Is it possible to move the samplers based on the threshold value of an image. In the attached the screen capture, the sampler should be placed at the area outlined by red circle, the reason being is the black is continuous in that area and this is my 'highlight' area i'm trying to find in my image. I am able to find in which area the black is continuous using histogram but dont know how to set the sampler to that location. Any thoughts? Let me know if i'm not clear in my brief pl.

Screen Shot 2013-03-02 at 12.12.31 PM.png

Votes

Translate

Translate

Report

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 ,
Mar 02, 2013 Mar 02, 2013

Copy link to clipboard

Copied

LATEST

You could apply the Maximum filter to reduce the black areas to a small size then the Minimum filter at the same value to turn the remaining black areas into larger squares. Load that result as a selection and convert to path with the tolerance set to 10. The center of any of the subpaths would be were to place a sampler. A value of 7 for the maximum/minimum filter seems to work with any resolution image in a quick test I did here.

But that method shows that the area on the right slightly higher than where you circled is the largest continuous area.

Votes

Translate

Translate

Report

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