Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Saves a file in Photoshop as jpg. File path is based on current document and filename is based on current layer.
var doc = app.activeDocument;
var fileName =;
var outputLocation= File( doc.path + "/" + fileName );
save( outputLocation );
function save( outputLocation ) {
var saveOptions = new ExportOptionsSaveForWeb;
saveOptions.format = SaveDocumentType.JPEG;
saveOptions.optimized = true;
saveOptions.interlaced = true;
saveOptions.quality = 100;
doc.exportDocument( new File( outputLocation ), ExportType.SAVEFORWEB, saveOptions );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.