Skip to main content
Participating Frequently
February 7, 2025
Answered

Need to place 0 vallue for CMY and 100 for K (black colored text )

  • February 7, 2025
  • 4 replies
  • 689 views

Hello friends, 
I have designed many pages for a publisher for print purposes with a CMYK profile, but I faced an issue with the black-coloured text, it's available in four values while the publisher needs it in only one colour {K 100 Value } while CMY value should be with 0 Value. I can do it manually but I have many files and don't have time to do these files. I need a script or any way to automatically change these text to convert these values with all opened PSD files or any specific folder. it's very important to me. 
Thanks in advance. 

Correct answer Stephen Marsh

@Hafeez332834440qpz 

 

Try this batch script. Test on a small number of duped files in a folder before processing all of your files. Consider making a backup of all files, just in case.

 

EDIT: Updated to v1.1 with a check to only recolour text layers using C91, M79, Y62, K97 to C0, M0, Y0, K100.

 

/*
Batch Change All PSD Text Layers to 0cmy100k.jsx
Stephen Marsh
v1.1 - 8th February 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/need-to-place-0-vallue-for-cmy-and-100-for-k-black-colored-text/td-p/15139158
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/changing-text-color-in-multiple-psd-s-with-actions/m-p/8550934#M281862
*/

#target photoshop;

main();

function main() {
    // Select folder where PSD/PSBs are held
    var selectFolder = Folder.selectDialog("Please select folder of PSDs");

    // If no folder selected, quit
    if (selectFolder == null) return;

    // Get an array of all PSD/PSBs in the folder
    var fileList = selectFolder.getFiles(/\.(psd|psb)$/i);

    // Iterate through file list
    for (var a in fileList) {
        open(fileList[a]);
        var doc = activeDocument;

        // Set the color to C0, M0, Y0, K100
        var textColour = new SolidColor();
        textColour.cmyk.cyan = 0;
        textColour.cmyk.magenta = 0;
        textColour.cmyk.yellow = 0;
        textColour.cmyk.black = 100;

        // Process all layers in the document
        for (var i = 0; i < doc.layers.length; i++) {
            changeTextLayerColor(doc.layers[i], textColour);
        }

        // Save changes and close the document
        doc.save();
        doc.close(SaveOptions.SAVECHANGES);
    }
}

alert("Script completed!");

function changeTextLayerColor(layer, color) {
    try {
        if (layer.typename == "ArtLayer" && layer.kind == LayerKind.TEXT) {

            // Ensure the layer is not locked
            layer.allLocked = false;

            // Select the layer before changing color
            activeDocument.activeLayer = layer;

            // Check if the text color is C91, M79, Y62, K97
            var textColor = app.activeDocument.activeLayer.textItem.color.cmyk;
            if (Math.round(textColor.cyan) == 91 &&
                Math.round(textColor.magenta) == 79 &&
                Math.round(textColor.yellow) == 62 &&
                Math.round(textColor.black) == 97) {

                // Change the color to C0, M0, Y0, K100
                layer.textItem.color = color;

            }

        } else if (layer.typename == "LayerSet") {
            // Process layers in layer set
            for (var i = 0; i < layer.layers.length; i++) {
                changeTextLayerColor(layer.layers[i], color);
            }
        }
    } catch (e) {
        alert("Error processing layer '" + layer.name + "': " + e);
    }
}

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

4 replies

Participant
February 8, 2025

You can use a Photoshop script to automate this process. Try running the following JavaScript in Photoshop:

 

 

var docs = app.documents;  
for (var i = 0; i < docs.length; i++) {  
    var doc = docs[i];  
    var textLayers = doc.artLayers;  

    for (var j = 0; j < textLayers.length; j++) {  
        var layer = textLayers[j];  
        if (layer.kind == LayerKind.TEXT) {  
            var textColor = layer.textItem.color;  
            textColor.cmyk.cyan = 0;  
            textColor.cmyk.magenta = 0;  
            textColor.cmyk.yellow = 0;  
            textColor.cmyk.black = 100;  
            layer.textItem.color = textColor;  
        }  
    }  
}  

 

 

Steps to use:

  1. Open Photoshop and go to File > Scripts > Script Editor.
  2. Paste the script above and run it.

This will convert all text layers in open documents to pure black (K=100, CMY=0). Let me know if you need further customization!

Participating Frequently
February 8, 2025

I've not found the Script Editor in the file > Script section 

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
February 8, 2025

@Hafeez332834440qpz 

 

Try this batch script. Test on a small number of duped files in a folder before processing all of your files. Consider making a backup of all files, just in case.

 

EDIT: Updated to v1.1 with a check to only recolour text layers using C91, M79, Y62, K97 to C0, M0, Y0, K100.

 

/*
Batch Change All PSD Text Layers to 0cmy100k.jsx
Stephen Marsh
v1.1 - 8th February 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/need-to-place-0-vallue-for-cmy-and-100-for-k-black-colored-text/td-p/15139158
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/changing-text-color-in-multiple-psd-s-with-actions/m-p/8550934#M281862
*/

#target photoshop;

main();

function main() {
    // Select folder where PSD/PSBs are held
    var selectFolder = Folder.selectDialog("Please select folder of PSDs");

    // If no folder selected, quit
    if (selectFolder == null) return;

    // Get an array of all PSD/PSBs in the folder
    var fileList = selectFolder.getFiles(/\.(psd|psb)$/i);

    // Iterate through file list
    for (var a in fileList) {
        open(fileList[a]);
        var doc = activeDocument;

        // Set the color to C0, M0, Y0, K100
        var textColour = new SolidColor();
        textColour.cmyk.cyan = 0;
        textColour.cmyk.magenta = 0;
        textColour.cmyk.yellow = 0;
        textColour.cmyk.black = 100;

        // Process all layers in the document
        for (var i = 0; i < doc.layers.length; i++) {
            changeTextLayerColor(doc.layers[i], textColour);
        }

        // Save changes and close the document
        doc.save();
        doc.close(SaveOptions.SAVECHANGES);
    }
}

alert("Script completed!");

function changeTextLayerColor(layer, color) {
    try {
        if (layer.typename == "ArtLayer" && layer.kind == LayerKind.TEXT) {

            // Ensure the layer is not locked
            layer.allLocked = false;

            // Select the layer before changing color
            activeDocument.activeLayer = layer;

            // Check if the text color is C91, M79, Y62, K97
            var textColor = app.activeDocument.activeLayer.textItem.color.cmyk;
            if (Math.round(textColor.cyan) == 91 &&
                Math.round(textColor.magenta) == 79 &&
                Math.round(textColor.yellow) == 62 &&
                Math.round(textColor.black) == 97) {

                // Change the color to C0, M0, Y0, K100
                layer.textItem.color = color;

            }

        } else if (layer.typename == "LayerSet") {
            // Process layers in layer set
            for (var i = 0; i < layer.layers.length; i++) {
                changeTextLayerColor(layer.layers[i], color);
            }
        }
    } catch (e) {
        alert("Error processing layer '" + layer.name + "': " + e);
    }
}

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Participating Frequently
February 8, 2025

Thanks, dear. It worked perfectly, but here is an issue: This script changed all text colours to the { K 100 }, while I needed to change only black. Blue. White and magenta colours also have been changed due to this script. I found this script very useful! 
Would it be possible to modify the script for changing only the black colour to the covert because I don't want to change other colours? I appreciate the way you are guiding me and helping me in this regard. 
Thank you very much.

Stephen Marsh
Community Expert
Community Expert
February 8, 2025

@Hafeez332834440qpz 

 

Yes, I assumed that all text was C91, M79, Y62, K97 and needed to be CMY0, K100. I didn't know that you had different colours.

 

How will the script be able to identify, consistently, only the incorrectly coloured text and layers?

 

Is there a consistent word in the name in the text layers or the content of the text layers to unequivocally identify these layers?

 

Is there a consistent colour value in these text layers, such as C91, M79, Y62, K97 as shown in your screenshot?

 

Can you attach a sample PSD file to your forum post? The PSD can be resized to 100px wide or tall, it's only to better understand the text layer content than anything else.

 

EDIT: Previous reply code updated to v1.1 with a check to only recolour text layers using C91, M79, Y62, K97 to C0, M0, Y0, K100.

Stephen Marsh
Community Expert
Community Expert
February 8, 2025

@Hafeez332834440qpz 

 

Have you tried searching the forum? Some examples include:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/text-layers-color-change-action/m-p/8823008#M71599

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/change-all-text-layers-color-for-multi-psd-s/m-p/12076158#M548062

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/changing-text-color-in-multiple-psd-s-with-actions/m-p/8550934#M281862

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-change-font-color-of-multiple-layers-in-multiple-files/m-p/11626250

 

Adjustments would be required for CMYK.

 

P.S. Even without a script, you can use the filter in the layers panel to isolate Text layer kinds, select all layers, activate the text tool, change the CMYK colour of all selected isolated text layers using the swatch in the text tool options bar etc. Some but not all of these steps can be recorded into an action.

creative explorer
Community Expert
Community Expert
February 7, 2025

@Hafeez332834440qpz are you asking us to create the script for you?

m
Participating Frequently
February 8, 2025

yes, I need a script to convert all ( Black only ) coloured text { 0 for CMY and 100 for K } rest of the colours should not be disturbed or changed. Thanks to you and Sir @Stephen Marsh for giving me such a valuable answer, I found a minor issue in his script, hope he will do it.