Copy link to clipboard
Copied
Hi.
I wan't to make a Photoshop action (or possibly a script) to set the white point on mulitple images. If I record an action with Curves or Levels, 'Sample in image to set white point', it will keep using the values of the first image, used to make the action. I want it to be as if I clicked the 'Set white point' in the same position on every image upon which the action is performed. Is this possible, and if so, how?
Thank you very much for your help. Best wishes, Mark.
For info... I'm creating a time lapse, using white background photos taken with a Raspberry pi camera, which has rather variable white balance results.
function whtPnts() {
sTT = stringIDToTypeID, arr = ['horizontal', 'vertical'];
(ref = new ActionReference()).putClass(sTT('colorSampler'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref)
dsc2 = new ActionDescriptor(); while(arr.length) dsc2.putUnitDouble
(sTT(arr.shift()), sTT('pixelsUnit'), arguments[+!arr.length])
dsc1.putObject(sTT('position'), sTT('point'), dsc2)
executeAction(sTT('make'), dsc1)
rgb = activeDocument.colorSamplers[0].color.rgb
c = sTT('channel'), p
...
Copy link to clipboard
Copied
function whtPnts() {
sTT = stringIDToTypeID, arr = ['horizontal', 'vertical'];
(ref = new ActionReference()).putClass(sTT('colorSampler'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref)
dsc2 = new ActionDescriptor(); while(arr.length) dsc2.putUnitDouble
(sTT(arr.shift()), sTT('pixelsUnit'), arguments[+!arr.length])
dsc1.putObject(sTT('position'), sTT('point'), dsc2)
executeAction(sTT('make'), dsc1)
rgb = activeDocument.colorSamplers[0].color.rgb
c = sTT('channel'), prprts = rgb.reflect.properties
dsc1 = new ActionDescriptor(), lst1 = new ActionList(); for(i = 0; i < 3; i++) {
(ref = new ActionReference()).putEnumerated(c, c, sTT(nme = prprts[i].name));
(dsc2 = new ActionDescriptor()).putReference(c, ref); (lst2 = new ActionList())
.putInteger(0), lst2.putInteger(rgb[nme]), dsc2.putList(sTT('input'), lst2)
lst1.putObject(sTT('levelsAdjustment'), dsc2)
}
dsc1.putList(sTT('adjustment'), lst1)
executeAction(sTT('levels'), dsc1)
}
whtPnts(250, 500)
Save above code to WhitePoints.jsx in Presets / Scripts of your Photoshop folder, then (re)launch Ps.
Create Action and Insert Menu Item to it from (File / Scripts) named WhitePoints.
Then use File / Automate / Batch to play your action on another files.
Ps. 250 & 500 is examplary pixels position for Color Sampler tool.
Copy link to clipboard
Copied
Hi Kukurykus,
It worked! That's absolutely brilliant. Thank you so much.
Did you write it yourself, especially for my problem? Or is it something that's generally available? I was beginging to think I'd have to write a stand alone c++ program to do it.
What is the language of the that script? Is there a resourse from which I can learn it?
Thanks again for your help.
Copy link to clipboard
Copied
Yes, especially for your problem, wrote in Extendscript: ADOBE PHOTOSHOP SCRIPTING
That is language made from old implementation of Javascript. Mark my answer as correct 😉
Copy link to clipboard
Copied
Love this script Kukurykus! How would I modify it to sample from the right side of the image? Like 250, 250 pixels but from the top right side instead of top lef?
Copy link to clipboard
Copied
whtPnts(activeDocument.width - 250, 250)
Copy link to clipboard
Copied
Brilliant! Thank you. Have been searching for this for quite saome time.