I have a script for Photoshop 5.5 (using PhotoScripter), which uses the following code to do a CMYK-conversion:
make new channel with properties {name:"temp"}
apply to image channel "temp" using (calculation {source:channel 1, calculation type:difference mode, second source:channel 2})
equalize channel "temp"
profile match from mode RGB mode from profile Apple RGB to mode CMYK mode to profile ICCProfile matching with relative colorimetric intent with black point compensation
delete channel "temp"
Now I am trying to migrate this method to Photoshop CS2, but am a bit puzzled about the appropriate code. So far I only found out about the profile match:
convert to profile "Working CMYK" intent relative colorimetric with blackpoint compensation
But I am quite lost when it comes to the ‘apply to image channel’ part…Can someone help me out?
I am lost as to what your ‘PhotoScripter’ actually does? As far as I am aware there are no ‘calculations’ in Photoshop scripting. Are you just creating your own 4th channel?
Okay, I exceuted the following script code on an image (my daughter) in Photoshop 5.5:
...
make new channel with properties {name:"temp"}
apply to image channel "temp" using (calculation {source:channel 1, calculation type:difference mode, second source:channel 2})
equalize channel "temp"
...
Martin, I quickly cropped down your sample image and I can create a new channel via ‘calculations’ (the best thing in PS for mask building) I still can’t work out where you are getting CMYK from? The images in your posted pics is still RGB with a additional channel. Calculations is recordable via an action so you could either call one of these or use ScriptListener code to do this.
The CMYK conversion is not my problem. It was previously done successfully by this snippet (and I can easily do it in Photoshop CS2):
profile match from mode RGB mode from profile Apple RGB to mode CMYK mode to profile ICCProfile matching with relative colorimetric intent with black point compensation
I am only asking myself what this piece of code is actually doing and how I can migrate it from Photoshop 5.5 to Photoshop CS. I simply don’t understand what is happening here:
make new channel with properties {name:"temp"}
apply to image channel "temp" using (calculation {source:channel 1, calculation type:difference mode, second source:channel 2})
equalize channel "temp"
And when I run just this piece of code on an image, I get the results as mentioned in my last post.
It appears to me that the piece of code you are talking about is just creating an additional channel after your composite RGB channels by making a calculation on channel 1 (red) with channel 2 (green) using the difference mode. However it looks like you also have an ‘apply to image’ in there too and this also is not available to scripting I think. Is this channel being used later for anything else?
No, the channel is just created, then your mentioned calculations are done. The next step is converting the image to CMYK. Afterwards the channel is deleted and the file is saved under a new name.
But I also do not know which effect the ‘apply to image’ has. Maybe I just ignore the whole channel creation and wait if there are any complaints :lol:
In CS3 I can use the following if I set up an actin (Action 1) to do the calculations:
tell application "Adobe Photoshop CS3"
tell document 1
do action "Action 1" from "Set 1"
set current channels to channel 4
adjust of background layer using equalize
end tell
end tell
Not an ideal way to go about it, but if you are not doing adding any variables to the calculation then it should work.
Thank you very much for your answer. I am familiar with executing actions via AppleScript, so could you please send me a screenshot of the action doing the calculations? That would be absolutely perfect. Because even if I am quite satisfied with my scripting abilities, I am a complete noob when it comes to image processing
I would like to thank everybody for helping me out, I now finalized a working version of the script for Photoshop CS2 And finally I found out that CS2’s resize image-method will only accept pixel values, not point values. Thank God It’s Friday :lol: