Copy link to clipboard
Copied
Hi everyone, I have hundreds of folders with PSD files saved with Maximize Compatibility enabled. These are archives that I havent accessed in a while, are years old, tens of TBs, and I need to free up space.
I want to batch remove the Maximize Compatibility option.
I tried creating an action in Photoshop that adds an empty layer, deletes it, and saves the file with Maximize Compatibility disabled in the preferences, but for some reason the file size doesn’t decrease (possibly the file has been created with the option, and it won't disable it).
I also tested the Image Processor with Maximize Compatibility turned off: this works but it generates a new folder of files. Then I have to manually go into each folder, delete the old PSDs, and move the new ones out of the subfolder.
Is there a way to speed up or automate this process? thank you!
I have tried various batch actions and existing scripts, without achieving the desired result.
Try the following script...
Originals will be overwritten. Work on a duplicate folder which contains PSD and subfolders with PSD. Double check the processed files with care. Don't open and save files across networks or external drives. Use at your own risk on original files that don't have a backup.
The root/base/top-level folder to be processed is selected, then the script will recurse
...
This 1.1 version offers a GUI.
/*
Batch Remove Maximize Compatibility from PSD v1-1.jsx
Stephen Marsh
30th August 2025 - v1.0: Initial release
30th August 2025 - v1.1: Consolidated the separate folder selection and file count prompts into a single GUI
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-remove-maximize-compatibility-from-psd-folders/td-p/15481712
*/
#target photoshop
main();
function main() {
var originalSetting = app.preferences.maximizeCompa
...
Copy link to clipboard
Copied
Hey, @_FT_. Welcome to the Photoshop Community. Photoshop currently does not host a specific feature that can do it.
Please wait for our community experts to chime in and provide help via the scripting path. Maybe @Stephen Marsh can help. (Sorry to put you on the spot like this.)
Thanks!
Sameer K
(Type '@' and type my name to mention me when you reply)
Copy link to clipboard
Copied
@Sameer K - all good, I was going to take a look a little later once I'm in front of a computer.
Copy link to clipboard
Copied
I don't have good news, there appears to be a bug, at least in 2025 (26.9.0).
When I save my test file manually, it goes from 29,508 KB with max on, to 23,734 KB when set to off/never.
However, whether I use an action or script (action manager code) with max set to off/false, the composite image is saved as 29,508 KB. This isn't covered by the ExtendScript DOM.
Which leaves UXP scripting.
EDIT:
Looks like it works when set in Preferences > File Handling: Never - but not when set the in the Save As step in an action or script. There are many different ways to batch save, I'll go through them later.
Copy link to clipboard
Copied
I have tried various batch actions and existing scripts, without achieving the desired result.
Try the following script...
Originals will be overwritten. Work on a duplicate folder which contains PSD and subfolders with PSD. Double check the processed files with care. Don't open and save files across networks or external drives. Use at your own risk on original files that don't have a backup.
The root/base/top-level folder to be processed is selected, then the script will recurse into all sub-folders. This could take a very long time to process.
/*
Batch Remove Maximize Compatibility from PSD.jsx
Stephen Marsh
30th August 2025 - v1.0: Initial release
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-remove-maximize-compatibility-from-psd-folders/td-p/15481712
*/
#target photoshop
main();
function main() {
// Confirmation dialog
var confirmMessage = "This script will:\n\n" +
"* Process all PSD/PSB files in a selected folder and subfolders\n" +
"* Temporarily change Maximize Compatibility setting to 'Never'\n" +
"* Overwrite original files (make sure you have backups!)\n" +
"* Restore your original Maximize Compatibility setting\n\n" +
"Do you want to continue?";
var proceed = confirm(confirmMessage);
if (proceed) {
var rootFolder = Folder.selectDialog("Select the root folder to process PSD/PSB files");
if (rootFolder) {
// Gather all PSD/PSB files first
var allFiles = [];
collectFiles(rootFolder, allFiles);
if (allFiles.length === 0) {
alert("No PSD/PSB files found.");
return;
}
// One final confirmation with file count as this could take some time
var finalConfirm = confirm("Found " + allFiles.length + " PSD/PSB files to process.\n\nDo you want to continue?");
if (!finalConfirm) {
return;
}
app.togglePalettes();
var prefs = app.preferences;
var originalSetting = prefs.maximizeCompatibility;
prefs.maximizeCompatibility = QueryStateType.NEVER;
try {
// Create progress window
var progressBarWin = new Window("palette", "Processing PSD Files", undefined, {closeButton: false});
progressBarWin.alignChildren = "fill";
var progressBar = progressBarWin.add("progressbar", undefined, 0, allFiles.length);
progressBar.preferredSize.width = 300;
var statusText = progressBarWin.add("statictext", undefined, "Starting...");
statusText.preferredSize.width = 300;
progressBarWin.show();
// Process each file
for (var i = 0; i < allFiles.length; i++) {
var file = allFiles[i];
statusText.text = "Processing (" + (i + 1) + " of " + allFiles.length + "): " + decodeURI(file.name);
progressBar.value = i + 1;
progressBarWin.update();
try {
processPSD(file);
} catch (e) {
alert("Error processing file: " + file.name + "\n" + e.message);
}
}
progressBarWin.close();
app.beep();
app.togglePalettes();
alert(allFiles.length + " files processed!" + "\n\n" + "Your original Maximize Compatibility setting has been restored.");
} catch (e) {
alert("An error occurred during processing:\n" + e.message);
} finally {
// Restore original setting
prefs.maximizeCompatibility = originalSetting;
}
}
}
}
///// Functions /////
function getCompatibilityLabel(value) {
switch (value) {
case QueryStateType.ALWAYS: return "Always";
case QueryStateType.NEVER: return "Never";
case QueryStateType.ASK: return "Ask";
default: return "Unknown";
}
}
function collectFiles(folder, fileArray) {
var files = folder.getFiles();
for (var i = 0; i < files.length; i++) {
var f = files[i];
if (f instanceof Folder) {
collectFiles(f, fileArray); // recursive
} else if (f instanceof File && f.name.match(/\.(psd|psb)$/i)) {
fileArray.push(f);
}
}
}
function processPSD(file) {
var doc = app.open(file);
var tempLayer = doc.artLayers.add();
tempLayer.name = "TempLayer";
tempLayer.remove();
var fileExt = file.name.split('.').pop().toLowerCase();
if (fileExt === "psd") {
// DOM PSD save to update Maximize Compatibility
var saveOptions = new PhotoshopSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.alphaChannels = true;
saveOptions.layers = true;
saveOptions.annotations = true;
saveOptions.spotColors = true;
doc.saveAs(file, saveOptions, true);
doc.close(SaveOptions.DONOTSAVECHANGES);
} else {
// Action Manager PSB save to update Maximize Compatibility
var idsave = charIDToTypeID("save");
var desc = new ActionDescriptor();
var idAs = charIDToTypeID("As ");
var descOptions = new ActionDescriptor();
var idMaxComp = stringIDToTypeID("maximizeCompatibility");
descOptions.putBoolean(idMaxComp, false); // Disable Maximize Compatibility
var idPht8 = charIDToTypeID("Pht8");
desc.putObject(idAs, idPht8, descOptions);
var idIn = charIDToTypeID("In ");
desc.putPath(idIn, doc.fullName);
var idDocI = charIDToTypeID("DocI");
desc.putInteger(idDocI, doc.id);
var idLwCs = charIDToTypeID("LwCs");
desc.putBoolean(idLwCs, true);
executeAction(idsave, desc, DialogModes.NO);
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
This 1.1 version offers a GUI.
/*
Batch Remove Maximize Compatibility from PSD v1-1.jsx
Stephen Marsh
30th August 2025 - v1.0: Initial release
30th August 2025 - v1.1: Consolidated the separate folder selection and file count prompts into a single GUI
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-remove-maximize-compatibility-from-psd-folders/td-p/15481712
*/
#target photoshop
main();
function main() {
var originalSetting = app.preferences.maximizeCompatibility;
// Create main window
var win = new Window("dialog", "Batch Remove Maximize Compatibility (v1.1)");
win.preferredSize.width = 400;
win.alignChildren = "fill";
// Create panel to group elements
var panel = win.add("panel", undefined, ""); // Remove the panel title
panel.alignment = ["fill", "top"];
panel.preferredSize.width = 400;
panel.orientation = "column";
panel.alignChildren = "fill";
panel.margins = 15;
// Instructions
var infoText = panel.add("statictext", undefined, "This script will process all PSD/PSB files in the selected folder and subfolders, disable Maximize Compatibility, overwrite the originals, and restore your original preference.", { multiline: true });
infoText.preferredSize.width = 400;
// Platform-specific height adjustment under the multiline text
if ($.os.match(/Windows/i)) {
infoText.preferredSize.height = 30;
} else {
infoText.preferredSize.height = 60; // Increase height for Mac
}
infoText.alignment = ["fill", "top"];
// Folder group
var folderGroup = panel.add("group");
folderGroup.orientation = "row";
folderGroup.alignChildren = ["left", "center"];
var browseBtn = folderGroup.add("button", undefined, "Browse...");
var folderPath = folderGroup.add("edittext", undefined, "");
folderPath.alignment = ["fill", "center"]; // Variable width
//folderPath.characters = 40; // Fixed width
// File count display
var fileCountText = panel.add("statictext", undefined, "No folder selected.");
fileCountText.preferredSize.width = 400;
// Buttons group
var buttonGroup = win.add("group");
buttonGroup.alignment = "right";
var cancelBtn = buttonGroup.add("button", undefined, "Cancel", { name: "cancel" });
var okBtn = buttonGroup.add("button", undefined, "OK", { name: "ok" });
var selectedFolder;
var allFiles = [];
browseBtn.onClick = function () {
selectedFolder = Folder.selectDialog("Select the root folder to process PSD/PSB files");
if (selectedFolder) {
folderPath.text = decodeURI(selectedFolder.fsName);
allFiles = [];
collectFiles(selectedFolder, allFiles);
if (allFiles.length > 0) {
fileCountText.text = "Found " + allFiles.length + " PSD/PSB files to process.";
} else {
fileCountText.text = "No PSD/PSB files found.";
}
}
};
okBtn.onClick = function () {
if (!selectedFolder) {
alert("Please select a folder first.");
return;
}
if (allFiles.length === 0) {
alert("No PSD/PSB files found.");
return;
}
var proceed = confirm("Found " + allFiles.length + " PSD/PSB files - all files will be overwritten! Do you want to continue?");
if (!proceed) {
win.close();
return;
}
app.togglePalettes();
win.hide();
processFiles(allFiles, originalSetting);
win.close();
};
cancelBtn.onClick = function () {
win.close();
};
win.show();
}
///// Functions /////
function processFiles(allFiles, originalSetting) {
var prefs = app.preferences;
prefs.maximizeCompatibility = QueryStateType.NEVER;
try {
var progressBarWin = new Window("palette", "Processing PSD Files", undefined, { closeButton: false });
progressBarWin.alignChildren = "fill";
var progressBar = progressBarWin.add("progressbar", undefined, 0, allFiles.length);
progressBar.preferredSize.width = 300;
var statusText = progressBarWin.add("statictext", undefined, "Starting...");
statusText.preferredSize.width = 300;
progressBarWin.show();
for (var i = 0; i < allFiles.length; i++) {
var file = allFiles[i];
statusText.text = "Processing (" + (i + 1) + " of " + allFiles.length + "): " + decodeURI(file.name);
progressBar.value = i + 1;
progressBarWin.update();
try {
processPSD(file);
} catch (e) {
alert("Error processing file: " + file.name + "\n" + e.message);
}
}
app.bringToFront;
progressBarWin.close();
app.togglePalettes();
app.beep();
alert(allFiles.length + " files processed!" + "\n\n" + "Your original Maximize Compatibility setting has been restored.");
} catch (e) {
alert("An error occurred during processing:\n" + e.message);
} finally {
prefs.maximizeCompatibility = originalSetting;
}
}
function collectFiles(folder, fileArray) {
var files = folder.getFiles();
for (var i = 0; i < files.length; i++) {
var f = files[i];
if (f instanceof Folder) {
collectFiles(f, fileArray);
} else if (f instanceof File && f.name.match(/\.(psd|psb)$/i)) {
fileArray.push(f);
}
}
}
function processPSD(file) {
var doc = app.open(file);
var tempLayer = doc.artLayers.add();
tempLayer.name = "TempLayer";
tempLayer.remove();
var fileExt = file.name.split('.').pop().toLowerCase();
if (fileExt === "psd") {
// DOM PSD save to update Maximize Compatibility
var saveOptions = new PhotoshopSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.alphaChannels = true;
saveOptions.layers = true;
saveOptions.annotations = true;
saveOptions.spotColors = true;
doc.saveAs(file, saveOptions, true);
doc.close(SaveOptions.DONOTSAVECHANGES);
} else {
// Action Manager PSB save to update Maximize Compatibility
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putBoolean(s2t("maximizeCompatibility"), false); // Disable Maximize Compatibility
descriptor.putObject(s2t("as"), s2t("largeDocumentFormat"), descriptor2);
descriptor.putPath(c2t("In "), doc.fullName);
descriptor.putInteger(s2t("documentID"), doc.id);
descriptor.putBoolean(s2t("lowerCase"), true);
executeAction(s2t("save"), descriptor, DialogModes.NO);
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
Hi @Stephen Marsh , it works perfectly! I see that you also encountered the bug where, if an action is supposed to discard the maximum compatibility, in practice it doesn’t actually happen. I haven’t figured out how you managed to avoid this error, but I really appreciate it.
The files are stored on a NAS; at the moment I’m testing on local backup copies and then I’ll overwrite them on the server. Do you recommend not letting the script work directly on a network resource? Thanks again!
Copy link to clipboard
Copied
I haven’t figured out how you managed to avoid this error, but I really appreciate it.
Yes, I had to "cheat". The script does the following:
1) Captures the current preference state for maximise
2) Sets the maximise state to never
3) Batch processes all psd/psb in all directories under the selected root directory
4) Sets the maximise state to the original setting
The files are stored on a NAS; at the moment I’m testing on local backup copies and then I’ll overwrite them on the server. Do you recommend not letting the script work directly on a network resource? Thanks again!
By @_FT_
This recommendation comes from Adobe and is also backed up by real world experience, both personal and from people posting on this forum over the years.
https://helpx.adobe.com/au/photoshop/kb/networks-removable-media-photoshop.html
Copy link to clipboard
Copied
thank you so much. and yeah, it makes sense to work on local storage, I'd really like the convenience but I fully understand the risk involved. thank you again.
(the fun thing is, 95% of the psd stored in my archive will never be needed again, but who knows which is the 5% I will need in the future haha)
Copy link to clipboard
Copied
Even though it takes up space, if there is layer corruption, at least the maximised flattened layer can be retreived, potentially rescuing a file that would otherwise be toast. Drive space is cheap these days, I shudder to think what I paid for an external 800 MB drive in the 1990's!
Copy link to clipboard
Copied
ah sure, it makes sense for more important files where a lot of photoshop work was done!
However most PSDs have minor edits/cleanup from the original photo, and I always keep my RAW files as long as the editing info (xmp), so worst case I have to redo edits for single photos. Potentially I could delete most of these psds and just keep the jpgs!
Storage space is definitely cheap even though, even though I miss the way prices were going down a decade ago 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now