Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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"

share|improve this answer
    
Thanks! I was hoping for something instant, but I'll manage with the script. I'll use this scheme. –  emrys57 Mar 29 at 17:36
    
Note that it is possible to show a prompt for the pixel coordinates. –  horatio Apr 1 at 14:40
    
What modifications are needed in the script above for it to work in Photoshop CC 2014.2.1? Thanks, Jeff –  Jeff Waymack Nov 25 at 1:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.