Skip to content

Instantly share code, notes, and snippets.

@branneman
Last active December 30, 2021 16:22
Show Gist options
  • Save branneman/b3d0daf03913112fc502326e7ea96183 to your computer and use it in GitHub Desktop.
Save branneman/b3d0daf03913112fc502326e7ea96183 to your computer and use it in GitHub Desktop.
Photoshop Script: Save an extra png on Document Save
main();
function main(){
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var Ext = decodeURI(app.activeDocument.name).replace(/^.*\./,'');
if(Ext.toLowerCase() != 'psd') return;
var Path = app.activeDocument.path;
var saveFile = File(Path + "/" + Name +".png");
if(saveFile.exists) saveFile.remove();
SavePNG(saveFile);
}
function SavePNG(saveFile){
var pngSaveOptions = new PNGSaveOptions();
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment