Skip to content

Instantly share code, notes, and snippets.

@NimaiMalle
Created June 26, 2018 03:52
Show Gist options
  • Save NimaiMalle/e63d9535df29f78170d78d6635c01e3d to your computer and use it in GitHub Desktop.
Save NimaiMalle/e63d9535df29f78170d78d6635c01e3d to your computer and use it in GitHub Desktop.
Save without dialog prompts in Photoshop
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 11;
var Name = decodeURI(activeDocument.name).replace(/\.[^\.]+$/, '');
var Path = decodeURI(activeDocument.path);
var saveFile = File(Path + "/" + Name + ".jpg")
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
opts = new PNGSaveOptions();
opts.compression = 9;
opts.transparency = true;
opts.interlaced = false;
var Name = decodeURI(activeDocument.name).replace(/\.[^\.]+$/, '');
var Path = decodeURI(activeDocument.path);
var saveFile = File(Path + "/" + Name + ".png");
activeDocument.changeMode(ChangeMode.RGB);
activeDocument.saveAs(saveFile, opts, true, Extension.LOWERCASE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment