Skip to main content
Participating Frequently
January 31, 2025
Answered

Is there a way to get Photoshop to stop asking to merge or don't merge when chaging color modes?

  • January 31, 2025
  • 2 replies
  • 483 views

Is there a way to get Photoshop to stop asking to merge or don't merge when chaging color modes?

Correct answer Stephen Marsh

Here is a combined version of the previous 3 separate scripts, using a single interface to select the colour mode:

 

// Attention: Changing modes without flattening may lead to unexpected results!

#target photoshop

// Function to convert string to type ID
var s2t = function (s) {
    return app.stringIDToTypeID(s);
};

// Function to convert color mode
function convertColorMode(mode) {
    var descriptor = new ActionDescriptor();
    descriptor.putClass(s2t("to"), s2t(mode));
    descriptor.putBoolean(s2t("flatten"), false);
    descriptor.putBoolean(s2t("rasterize"), false);
    executeAction(s2t("convertMode"), descriptor, DialogModes.NO);
}

// Create the dialog
var dialog = new Window("dialog", "Convert Color Mode (Without Flatten Prompt)");
dialog.orientation = "column";
dialog.alignChildren = ["fill", "top"];
dialog.preferredSize = [400, -1]; // Set the preferred width to 400px, height will adjust automatically

// Panel group with dropdown menu
var panelGroup = dialog.add("panel", undefined, "Select Color Mode");
panelGroup.orientation = "column";
panelGroup.alignChildren = ["fill", "top"];

var dropdown = panelGroup.add("dropdownlist", undefined, ["CMYK", "RGB", "Lab"]);
dropdown.selection = 0;

// Cancel and OK buttons
var buttonGroup = dialog.add("group");
buttonGroup.orientation = "row";
buttonGroup.alignment = "right";

var cancelButton = buttonGroup.add("button", undefined, "Cancel", { name: "cancel" });
var okButton = buttonGroup.add("button", undefined, "OK", { name: "ok" });

// OK button event handler
okButton.onClick = function () {
    var selectedMode = dropdown.selection.text;
    var mode;
    switch (selectedMode) {
        case "CMYK":
            mode = "CMYKColorMode";
            break;
        case "RGB":
            mode = "RGBColorMode";
            break;
        case "Lab":
            mode = "labColorMode";
            break;
    }
    convertColorMode(mode);
    dialog.close();
};

// Cancel button event handler
cancelButton.onClick = function () {
    dialog.close();
};

// Show the dialog
dialog.show();

2 replies

Stephen Marsh
Community Expert
Community Expert
February 1, 2025

@Herbie22012266fjw7 

 

It’s not just adjustment layers, blend modes for any layer may result in a different visual result as is common for CMYK colour mode or the blend mode may not even be available as is the case for many blend modes in Lab colour mode.

 

If you are simply using the Image > Mode menu and not Convert to Profile, the following scripts can be used to change modes without the warning:

 

Image > Mode > CMYK

 

#target photoshop
var s2t = function (s) {
    return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
descriptor.putClass(s2t("to"), s2t("CMYKColorMode"));
descriptor.putBoolean(s2t("flatten"), false);
descriptor.putBoolean(s2t("rasterize"), false);
executeAction(s2t("convertMode"), descriptor, DialogModes.NO);

 

 

Image > Mode > RGB

 

#target photoshop
var s2t = function (s) {
    return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
descriptor.putClass(s2t("to"), s2t("RGBColorMode"));
descriptor.putBoolean(s2t("flatten"), false);
descriptor.putBoolean(s2t("rasterize"), false);
executeAction(s2t("convertMode"), descriptor, DialogModes.NO);

 

 

Image > Mode > Lab

 

#target photoshop
var s2t = function (s) {
    return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
descriptor.putClass(s2t("to"), s2t("labColorMode"));
descriptor.putBoolean(s2t("flatten"), false);
descriptor.putBoolean(s2t("rasterize"), false);
executeAction(s2t("convertMode"), descriptor, DialogModes.NO);

 

 

  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

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

Here is a combined version of the previous 3 separate scripts, using a single interface to select the colour mode:

 

// Attention: Changing modes without flattening may lead to unexpected results!

#target photoshop

// Function to convert string to type ID
var s2t = function (s) {
    return app.stringIDToTypeID(s);
};

// Function to convert color mode
function convertColorMode(mode) {
    var descriptor = new ActionDescriptor();
    descriptor.putClass(s2t("to"), s2t(mode));
    descriptor.putBoolean(s2t("flatten"), false);
    descriptor.putBoolean(s2t("rasterize"), false);
    executeAction(s2t("convertMode"), descriptor, DialogModes.NO);
}

// Create the dialog
var dialog = new Window("dialog", "Convert Color Mode (Without Flatten Prompt)");
dialog.orientation = "column";
dialog.alignChildren = ["fill", "top"];
dialog.preferredSize = [400, -1]; // Set the preferred width to 400px, height will adjust automatically

// Panel group with dropdown menu
var panelGroup = dialog.add("panel", undefined, "Select Color Mode");
panelGroup.orientation = "column";
panelGroup.alignChildren = ["fill", "top"];

var dropdown = panelGroup.add("dropdownlist", undefined, ["CMYK", "RGB", "Lab"]);
dropdown.selection = 0;

// Cancel and OK buttons
var buttonGroup = dialog.add("group");
buttonGroup.orientation = "row";
buttonGroup.alignment = "right";

var cancelButton = buttonGroup.add("button", undefined, "Cancel", { name: "cancel" });
var okButton = buttonGroup.add("button", undefined, "OK", { name: "ok" });

// OK button event handler
okButton.onClick = function () {
    var selectedMode = dropdown.selection.text;
    var mode;
    switch (selectedMode) {
        case "CMYK":
            mode = "CMYKColorMode";
            break;
        case "RGB":
            mode = "RGBColorMode";
            break;
        case "Lab":
            mode = "labColorMode";
            break;
    }
    convertColorMode(mode);
    dialog.close();
};

// Cancel button event handler
cancelButton.onClick = function () {
    dialog.close();
};

// Show the dialog
dialog.show();
D Fosse
Community Expert
Community Expert
January 31, 2025

No.

 

Layered files usually contain adjustment layers. Any numerical adjustment is color space specific, and when you're talking changing modes, the adjustment most likely doesn't even make any sense at all.

 

So your choice is to flatten to maintain appearance - which is what in most cases is wanted - or discard the adjustment layers altogether, sending you back to start. Few people want that.

Participating Frequently
January 31, 2025

Thank you. Adjustment layers are not a concern.

 

I am stylizing a bunch of photos which requires changing modes twice, and it keeps asking me to merge or not, for every photo, and the answer is always Do Not Merge. So annoying! I wish there was a preference I could set for Do No Ask.