6 Replies Latest reply on Sep 25, 2010 1:48 AM by c.pfaffenbichler

    Apply adjustment to affect all layers when xport layers to files

    tedski

      Hi.

       

      Have a set of sequence images opened with Bridge and placed in photoshop as individual layers. I´ve croped the image and

      applyed som adjusments eg. curves etc. Now i want to save the layers as files from the file-scripts having the layer adjustments affecting

      my layers before saving.

       

      /Tedski

        • 1. Re: Apply adjustment to affect all layers when xport layers to files
          c.pfaffenbichler Level 9

          It’s certainly possible to achieve something like that.

          But I think it might be easier to start with a new Script and do without the dialog at all instead of trying to change the existing one.

           

          How experienced are you with JavaScript?

          • 2. Re: Apply adjustment to affect all layers when xport layers to files
            tedski Level 1

            Hi c.pfaff......

             

            Not good enough to script photoshop i guess. Maybe i´m doing it the wrong way all together. Is it another way of adjust multiple files without bringing them into photoshop as layers?

             

            /Tedski

            • 3. Re: Apply adjustment to affect all layers when xport layers to files
              c.pfaffenbichler Level 9

              One could create a Script that offers a dialog to select files (or a folder) and subsequently opens and adds the Adjustments to all those files.

               

              If nobody else has some Scripts ready for this or the original task I might give it a look on the weekend.

              But you might also search or ask at http://www.ps-scripts.com/

              • 4. Re: Apply adjustment to affect all layers when xport layers to files
                Michael L Hale Level 5

                tedski wrote:


                Is it another way of adjust multiple files without bringing them into photoshop as layers?

                 

                If you want to apply the same adjustment( or add the same adjustment layer ) to every image you could make an action that applies the adjustment( or adds the adj layer ) then either batch that action or use Image Processor.

                • 5. Re: Apply adjustment to affect all layers when xport layers to files
                  tedski Level 1

                  I went to javascript forums where i got help editing *.jsx for photoshop, so it now applies adjustment to every single layer before saving as a file.

                  Thanks all for your time.

                   

                  /Tedski

                  • 6. Re: Apply adjustment to affect all layers when xport layers to files
                    c.pfaffenbichler Level 9

                    Well, you don’t need it anymore, but I still gave a Script that saves the pixel-layers as separate files with the Adjustment Layers flattened in a try; only for psd, though, so no format-selection.

                    If you want to give it a try …

                     

                    // create psd-copies of  all pixel-layers with adjustment layers applied to them;

                    // thanks to xbytor for the regexp;

                    // 2010, use at your own risk;

                    #target photoshop

                    if (app.documents.length > 0) {

                      var thedoc = app.activeDocument;

                    var docName = thedoc.name;

                    var basename = docName.match(/(.*)\.[^\.]+$/)[1];

                    // get path;

                      try {var docPath = thedoc.path}

                      catch (e) {var docPath = "~/Desktop"};

                    // duplicate;

                      var myDocument = thedoc.duplicate ("thecopy", false);

                      var theLayers = hideAndCollectPixelLayers(myDocument);

                      var theArtLayers = new Array

                      if (theLayers.length > 1) {

                    // show one layer and save psd;

                        for (var m = 0; m < theLayers.length; m++) {

                          var aLayer = theLayers[m];

                          aLayer.visible = true;

                          savePsd (myDocument, aLayer.name, docPath, basename);

                          aLayer.visible = false;

                          };

                        };

                    // close duplicate;

                      myDocument.close(SaveOptions.DONOTSAVECHANGES)

                      };

                    ////////////////////////////////////

                    ////////////////////////////////////

                    ////////////////////////////////////

                    ////// function to collect all pixel-layers and hide them //////

                    function hideAndCollectPixelLayers (theParent) {

                    if (!allLayers) {

                    var allLayers = new Array}

                    else {};

                    for (var m = theParent.layers.length - 1; m >= 0;m--) {

                    var theLayer = theParent.layers[m];

                    // apply the function to layersets;

                        if (theLayer.typename == "ArtLayer") {

                    // process pixel-layers;

                          if (theLayer.kind == "LayerKind.GRADIENTFILL" || theLayer.kind == "LayerKind.LAYER3D" || theLayer.kind == "LayerKind.NORMAL" ||

                          theLayer.kind == "LayerKind.PATTERNFILL" || theLayer.kind == "LayerKind.SMARTOBJECT" || theLayer.kind == "LayerKind.SOLIDFILL" ||

                          theLayer.kind == "LayerKind.TEXT" || theLayer.kind == "LayerKind.VIDEO") {

                            theLayer.visible = false;

                            allLayers.push(theLayer)

                            }

                          }

                        else {

                    allLayers = allLayers.concat(hideAndCollectPixelLayers(theLayer))

                    // this line includes the layer groups;

                    // allLayers.push(theLayer);

                          }

                        };

                      return allLayers

                    };

                    ////// function to save psds //////

                    function savePsd (myDocument, layerName, docPath, basename) {

                    // this clause changes the name if a file of that name exists in that location;

                      while (File(docPath+'/'+basename+"_"+layerName+".psd").exists == true) {

                        layerName = layerName+"_"+"1"

                        };

                      var thecopy = myDocument.duplicate (thecopy, true);

                    psdOpts = new PhotoshopSaveOptions();

                    psdOpts.embedColorProfile = true;

                    psdOpts.alphaChannels = false;

                    psdOpts.layers = true;

                    psdOpts.spotColors = true;

                    thecopy.saveAs((new File(docPath+'/'+basename+"_"+layerName+".psd")),psdOpts,true);

                    thecopy.close(SaveOptions.DONOTSAVECHANGES)

                      };