Created
September 29, 2025 23:23
-
-
Save AldeRoberge/8f5f78b324387eb3eda1365befc20e3e to your computer and use it in GitHub Desktop.
batchInvertColorPhotoshopScript.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target photoshop | |
// Ask the user to select a folder | |
var inputFolder = Folder.selectDialog("Select the folder containing PNG files to invert"); | |
// Check if the user selected a folder | |
if (inputFolder != null) { | |
// Get all the PNG files in the selected folder | |
var pngFiles = inputFolder.getFiles("*.png"); | |
// Loop through each PNG file | |
for (var i = 0; i < pngFiles.length; i++) { | |
var file = pngFiles[i]; | |
// Open the PNG file in Photoshop | |
var doc = open(file); | |
// Invert the colors of the image | |
doc.activeLayer.invert(); | |
// Save the file as a PNG, overwriting the original | |
var pngSaveOptions = new PNGSaveOptions(); | |
doc.saveAs(file, pngSaveOptions, true, Extension.LOWERCASE); | |
// Close the document without saving changes again | |
doc.close(SaveOptions.DONOTSAVECHANGES); | |
} | |
alert("All PNGs have been processed."); | |
} else { | |
alert("No folder selected."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment