0 Replies Latest reply on Sep 7, 2016 10:36 PM by sumank38193215

    Save PNGs from two different layer groups in combination "nCp"

    sumank38193215

      This is the screenshots of two different scenario that I want to achieve

       

      In the 1st group 2 different PNG images are there (Iphone & Android mock-ups)

      In the 2nd group 40 different PNG images are there (app inner screen pages)

       

      Now I want to Save PNGs in a particular location (ie, Local Storage)

      In the combination of 1st image of group 1 with all the images of gruop 2.

      In the combination of 2nd image of group 1 with all the images of gruop 2.

       

      So I want in total 80 PNG images should save in my local storage.

      Layer 1.pngLayer 2.png

       

      Here is the scripting

       

      #target photoshop

       

      var doc=app.activedocument;

      var layer=doc.activeLayer;

      var group=layer.parent.layers;

       

      function SavePNG(){

          var pngOptions=new PNGSaveOptions();

          if (group[0].name==" "){

              var str=" ";

              }else{

                  var str="-"+grpup[0].name;

                  }

              var path=File(doc.path+"/"+Layer.name+str+".png");

              doc.SaveAs(path,pngOption,true,Estension.LOWERCASE);

              }

         

          function SwitchLayer(i){

              layer.visible=false;

              doc.activeLayer=group[i]

              layer=doc.activeLayer;

              layervisible=true;

              }

         

          for (var i=0; i<group.length;i++){

              SavePNG();

              if(i+1>=group.length){

                  break

                  }

              SwitchLayer(i+1);

              }

         

          SwitchLayer(1);

         

          alert("All Done!");

       

       

      Regards

      Suman Kanti Roy

      Portfolio Link