Skip to main content
Inspiring
May 2, 2012
Answered

How to add a color sampler through Photoshop Scripting?

  • May 2, 2012
  • 1 reply
  • 3437 views

Hi,

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

Could you please help me on this.

thanks,

rajiv.s

This topic has been closed for replies.
Correct answer c.pfaffenbichler

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).

1 reply

c.pfaffenbichler
c.pfaffenbichlerCorrect answer
Community Expert
May 2, 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).

Chuck Uebele
Community Expert
May 12, 2012

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.