Copy link to clipboard
Copied
I recorded a simple action to convert folders of images to CMYK, the action goes as follows:
1. convert to CMYK
2. save
3. close out of file
I use this action on a daily basis to convert large batches of images, and after upgrading to the latest update it no longer works. I get an error saying "Convert mode is not currently available". Yet if I manually do these steps to each image, it works just fine.
Copy link to clipboard
Copied
Moving to the Photoshop forum from Community Help
Copy link to clipboard
Copied
I can not reproduce problem without more informations. Which version of Photoshop you are using? I am on Win running 21.0.1 version. Can you post screenshot with error message and Convert Mode step in action expanded.
Copy link to clipboard
Copied
Same version sadly, and I can't get it to work. I still have last year's release on my mac and it works just fine which leads me to believe this is an issue with the new update. I've attached screenshots of the issue.
Copy link to clipboard
Copied
So the problem is when running Batch script, otherwise it works when playing action on its own? Can you upload action somewhere to test it?
Copy link to clipboard
Copied
If your action does not have an open command step, you should not use the "override action open..." checkbox in the Batch interface.
Copy link to clipboard
Copied
I modified the following script to do the same thing as your action/batch (convert to working CMYK and overwrite the original files, it is presumed that the input file formats are capable of being saved as CMYK):
//forums.adobe.com/thread/2593940
//forums.adobe.com/message/10926314#10926314
#target photoshop
var inFolder = Folder.selectDialog("Select the input folder", "");
var inFiles = inFolder.getFiles();
app.displayDialogs = DialogModes.NO;
for (var a = 0; a < inFiles.length; a++) {
try {
var inDoc = open(inFiles[a]);
inDoc.changeMode(ChangeMode.CMYK);
inDoc.save();
inDoc.close();
} catch (e) {
continue;
}
};
alert("Input files converted to working space CMYK and saved with embedded ICC profile");
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
I know this is an old thread, but I'm trying to learn scripting for Ps and also getting exact same message
Ps v22.0.1 on Win10
My script is:
var doc = app.activeDocument;
var indexedDoc = doc.duplicate('_tmpIndexed', true);
var indexedOptions = new IndexedConversionOptions();
indexedOptions.colors = 7;
/*indexedOptions.palette = Palette.LOCALSELECTIVE;
indexedOptions.forced = ForcedColors.NONE;
indexedOptions.transparency = false;
indexedOptions.dither = Dither.NONE;*/
indexedDoc.changeMode(ChangeMode.INDEXEDCOLOR, indexedOptions);
Any insight?
Copy link to clipboard
Copied
Just a guess, but is the doc in any other mode than RGB?
Copy link to clipboard
Copied
It's AdobeRGB. Tried with RGB JPEG and your guess is valid - it does the thing. But how do I convert from AdobeRGB then? Executing
indexedDoc.changeMode(ChangeMode.RGB);
before INDEXEDCOLOR doesn't help 😞
Copy link to clipboard
Copied
Your code works OK on my Mac (Mojave OS) and Photoshop 2019.
The duped file is in indexed mode, without any reported errors... The errors only show if the doc is not in RGB mode (in Photoshop, only RGB can be indexed, unlike in say Acrobat where other colour modes can be indexed).
I did note that it did not reduce down to 7 colours though. I had to uncomment indexedOptions.palette to get it to reduce colours.
The RGB mode change appears to be correct as well.
EDIT: I just tried and all works fine in Win 10 with Photoshop 2021 as well.
Copy link to clipboard
Copied
You mean it converts from AdobeRGB?
Copy link to clipboard
Copied
Yes, Indexed Colour does not care about the profile/space – it is just a subset of RGB mode in Photoshop.
If you wish to convert specifically to sRGB first:
app.activeDocument.convertProfile("sRGB IEC61966-2.1", Intent.RELATIVECOLORIMETRIC, true, false);
Copy link to clipboard
Copied
Createt new document ProPhoto RGB (16bpc). Added few random color brush strokes. Running the script I pasted above, gives the error I pasted above 😞 Same if I add
indexedDoc.convertProfile("sRGB IEC61966-2.1", Intent.RELATIVECOLORIMETRIC, true, false);
just before converting to indexed 😕
Copy link to clipboard
Copied
I was working on 8-bpc data, when you mentioned 16-bpc that was the clue!
So add this before the indexed mode change:
indexedDoc.bitsPerChannel = BitsPerChannelType.EIGHT;
It doesn't matter if manually using the GUI, actions or scripting, the same base laws apply, in Photoshop indexed colour is created from RGB/8 data. In hindsight the other clue was the error mentioning mode, I was focused on colour mode, however bit depth also resides under mode as well!
And here is the code in full that works for me:
var doc = app.activeDocument;
var indexedDoc = doc.duplicate('_tmpIndexed', true);
var indexedOptions = new IndexedConversionOptions();
indexedOptions.colors = 7;
indexedOptions.palette = Palette.LOCALSELECTIVE;
/*indexedOptions.forced = ForcedColors.NONE;
indexedOptions.transparency = false;
indexedOptions.dither = Dither.NONE;*/
app.activeDocument.bitsPerChannel = BitsPerChannelType.EIGHT;
app.activeDocument.changeMode(ChangeMode.INDEXEDCOLOR, indexedOptions);
Copy link to clipboard
Copied
Thank you 🙂 That worked
Sorry it took a bit to check and reply 🙂
Copy link to clipboard
Copied
Have you tried re-recording the action from scratch?