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
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).
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).
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.
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.
Copy link to clipboard
Copied
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.