Mobile app version of vmapp.org
Login or Join
Gonzalez368

: How do I make a photoshop action pick a color from the image? I am trying to capture a photoshop action that requires setting the foreground color by using the color picker at a particular

@Gonzalez368

Posted in: #Actions #AdobePhotoshop

I am trying to capture a photoshop action that requires setting the foreground color by using the color picker at a particular location in the image.

When I record the action, a 'set foreground color' operation is recorded, but to a fixed color, the one I have just picked. I want the action to be something like "use picker to capture color at location (x,y)".

Is there any way to persuade Photoshop (either CS6 or CC) to record this sort of action?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez368

2 Comments

Sorted by latest first Latest Oldest Best

 

@Murray976

I've rewrote the code provided by Horitio so it'll work in newer versions of photoshop.

var docRef = app.activeDocument;
var pixelLoc = [32,42];
var colorSamplerRef = docRef.colorSamplers.add(pixelLoc);
app.foregroundColor = colorSamplerRef.color;


x = 32 and y = 42. Set this to whatever you need it to be.

Hint: Tap f8 to figure out what the x and y location of your mouse are.

10% popularity Vote Up Vote Down


 

@Gail6891361

Here is a script which samples the 10,10 pixel location and sets the foreground color:

var docRef = app.activeDocument
var pixelLoc = [UnitValue("10 pixels") , UnitValue("10 pixels")];
var colorSamplerRef = docRef.colorSamplers.add(pixelLoc);
app.foregroundColor = colorSamplerRef.color


You can run the script as part of an action sequence.

Further reading google: "adobe photoshop scripting reference"

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme