3 Replies Latest reply on Dec 17, 2017 5:09 AM by mirthev11883376

    Error 8800 when trying to save as PNG

    mirthev11883376

      Hey there!

       

      I'm trying to save a bunch of PSD files as pngs but the script fails when saving, giving the error:

       

      Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

      - <no additional information available>

      Line: 27

      ->  docRef.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);

       

      My script:

       

      var allFiles = app.openDialog();
      var allPSDs = new Array();
      var fileMask = /\.(psd|)$/i;
      
      for(var i = 0; i < allFiles.length; i++)
      {
      if (allFiles[i] instanceof File && allFiles[i].fullName.search(fileMask) != -1)
      allPSDs.push(allFiles[i]);
      }
      
      
      for(var i = 0; i < allPSDs.length; i++)
      {
      var docRef = app.open(allPSDs[i]);
      var pngFile = new File(activeDocument.path.fullName + "/Export/" + docRef.name + '.png');
      
      docRef.flatten();
      
      var opts = new ExportOptionsSaveForWeb();
      opts.format = SaveDocumentType.PNG;
      opts.PNG8 = false;
      opts.transparency = false;
      opts.interlaced = false;
      opts.quality = 100;
      opts.includeProfile = false;
      
      docRef.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);
      
      // also doesn't work / gives the same error:
      // var pngSaveOptions = new PNGSaveOptions();
      // app.activeDocument.saveAs(pngFile, pngSaveOptions, true, Extension.LOWERCASE);
      
      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
      }
      

       

      What did I do wrong?