5 Replies Latest reply on Jun 4, 2013 8:06 AM by Michael L Hale

    Photoshop scripting, export to png?


      I use the following code:


      function SavePNG(saveFile){

        var opts = new ExportOptionsSaveForWeb();

        opts.format = SaveDocumentType.PNG;

        opts.PNGB = true;

        opts.quality = 100;

        pngFile = new File(saveFile);

        opts.includeProfile = true;

        app.activeDocument.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);



      It almost workable, but it works with fully visible or fully invisible areas only. For example if I have a transparent layer and add a second transparent layer with a red rect with opacity 50%, then I will got an image where the transparency of this rect is 100% (fully visible).


      How to solve this problem? I use Photoshop CS6 (Mac OS version).