Photoshop CS6: javaScript DOM Save for Web bug

  • 1
  • Problem
  • Updated 6 years ago
  • (Edited)
Photoshop CS6 ver 13.0.1 O.S. Windows 7

To replicate the problem:-
Goto Save for Web and save as JPG, then select HTML Only or HTML and Images.
Once you have done the save you can not use the DOM to save a jpg image, the file is written with an html extension. You need to go back to the GUI to save "Images Only" before you can use.
Example code...


var saveFile = File(Folder.desktop + "/SaveForWeb.jpg");
SaveForWeb(saveFile,80);

function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 142 Reply Likes

Posted 6 years ago

  • 1

Be the first to post a reply!