4 Replies Latest reply on Jul 10, 2011 7:21 AM by JJMack

    1st picture = 1st image from folder, 2nd = first 2 images, third = first 3 images, and so on

    toshk

      I have one folder with a series of images and I want to create a new folder where the first image is just the first image, the second image is the first 2 images (blending - lighten), the third made up of the first 3 images, and so on.   this needs to be done with a few hundred images, hence why i need an automatic way of doing it.

       

      Thanks

        • 1. Re: 1st picture = 1st image from folder, 2nd = first 2 images, third = first 3 images, and so on
          c.pfaffenbichler Level 9
          the second image is the first 2 images (blending - lighten), the third made up of the first 3 images, and so on.

          That is definitely thought through?

          Could you provide some sample images and the intended result?

          • 2. Re: 1st picture = 1st image from folder, 2nd = first 2 images, third = first 3 images, and so on
            toshk Level 1

            What I am hoping to achieve is a video where the star trails are forming as you are watching. Here is a short sample that I made manually to show what I am after (the video is not made in photoshop, just showing what i need the pictures for):

             

             


            Here is a picture showing how I need to images to be made (this would normally be 4 separate images however this way saved time uploading):

             

            http://dl.dropbox.com/u/21779294/sample%20trail.jpg

             

            What I need is for each image to contain all of the images previous to it blended together.   So that as you flick through the pictures the star trails get longer.

            • 3. Re: 1st picture = 1st image from folder, 2nd = first 2 images, third = first 3 images, and so on
              c.pfaffenbichler Level 9

              Could you give this a try?

               

              // save copies with the selected files progressively applied with blend mode lighten;
              // 2011, use it at your own risk;
              #target photoshop
              // select files;
              if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.eps', true)} 
              else {var theFiles = File.openDialog ("please select files", getFiles, true)};
              // tif options;
              tifOpts = new TiffSaveOptions();
              tifOpts.embedColorProfile = true;
              tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
              tifOpts.alphaChannels = false;
              tifOpts.byteOrder = ByteOrder.MACOS;
              tifOpts.layers = false;
              // open first file;
              var theFile = app.open(File(theFiles[0]));
              var basename = theFile.name.match(/(.*)\.[^\.]+$/)[1];
              var docPath = theFile.path;
              // create folder;
              var folderPath = docPath + "/results";
              if (Folder(folderPath).exists == false) {
                   var theFolder = Folder(folderPath).create()
                   };
              // save file;
              theFile.saveAs((new File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(1,3)+".tif")),tifOpts,false);
              // work through the rest of the files;
              if (theFiles) {
                   for (var m = 1; m < theFiles.length; m++) {
                        placeFile(theFiles[m]);
                        theFile.layers[0].blendMode = BlendMode.LIGHTEN;
                        theFile.flatten();
                        theFile.saveAs((new File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(m+1,3)+".tif")),tifOpts,false);
                        };
                   theFile.close(SaveOptions.DONOTSAVECHANGES);
                   };
              ////////////////////////////////////
              ////////////////////////////////////
              ////////////////////////////////////
              ////// get psds, tifs and jpgs from files //////
              function getFiles (theFile) {
                  if (theFile.name.match(/\.(jpg|tif|psd|pdf|)$/i)) {
                      return true
                      };
                   };
              ////// buffer number with zeros //////
              function bufferNumberWithZeros (number, places) {
                   var theNumberString = String(number);
                   for (var o = 0; o < (places - String(number).length); o++) {
                        theNumberString = String("0" + theNumberString)
                        };
                   return theNumberString
                   };
              ////// place //////
              function placeFile (aPath) {
              // =======================================================
              var idPlc = charIDToTypeID( "Plc " );
                  var desc2 = new ActionDescriptor();
                  var idnull = charIDToTypeID( "null" );
                  desc2.putPath( idnull, new File( aPath ) );
                  var idFTcs = charIDToTypeID( "FTcs" );
                  var idQCSt = charIDToTypeID( "QCSt" );
                  var idQcsa = charIDToTypeID( "Qcsa" );
                  desc2.putEnumerated( idFTcs, idQCSt, idQcsa );
                  var idOfst = charIDToTypeID( "Ofst" );
                      var desc3 = new ActionDescriptor();
                      var idHrzn = charIDToTypeID( "Hrzn" );
                      var idRlt = charIDToTypeID( "#Rlt" );
                      desc3.putUnitDouble( idHrzn, idRlt, 0.000000 );
                      var idVrtc = charIDToTypeID( "Vrtc" );
                      var idRlt = charIDToTypeID( "#Rlt" );
                      desc3.putUnitDouble( idVrtc, idRlt, -0.000000 );
                  var idOfst = charIDToTypeID( "Ofst" );
                  desc2.putObject( idOfst, idOfst, desc3 );
              executeAction( idPlc, desc2, DialogModes.NO );
              };
              

              • 4. Re: 1st picture = 1st image from folder, 2nd = first 2 images, third = first 3 images, and so on
                JJMack Most Valuable Participant

                That script modified to save quality 10 jpeg files and a layerd Tiff at the end

                 

                // save copies with the selected files progressively applied with blend mode lighten;

                // 2011, use it at your own risk;

                #target photoshop

                // select files;

                if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.eps', true)}

                else {var theFiles = File.openDialog ("please select files", getFiles, true)};

                // tif options;

                tifOpts = new TiffSaveOptions();

                tifOpts.embedColorProfile = true;

                tifOpts.imageCompression = TIFFEncoding.TIFFLZW;

                tifOpts.alphaChannels = false;

                tifOpts.byteOrder = ByteOrder.MACOS;

                tifOpts.layers = true;

                // jpg options;

                jpgOpts = new JPEGSaveOptions();

                jpgOpts.embedColorProfile = true;

                jpgOpts.formatOptions = FormatOptions.STANDARDBASELINE;

                jpgOpts.matte = MatteType.NONE;

                jpgOpts.quality = 10;

                // open first file;

                var theFile = app.open(File(theFiles[0]));

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

                var docPath = theFile.path;

                // create folder;

                var folderPath = docPath + "/results";

                if (Folder(folderPath).exists == false) {

                     var theFolder = Folder(folderPath).create()

                     };

                // save file;

                theFile.saveAs((File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(1,3)+".jpg")),jpgOp ts,true,Extension.LOWERCASE);

                // work through the rest of the files;

                if (theFiles) {

                     for (var m = 1; m < theFiles.length; m++) {

                          placeFile(theFiles[m]);

                          theFile.layers[0].blendMode = BlendMode.LIGHTEN;

                          //theFile.flatten();

                          //theFile.saveAs((new File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(m+1,3)+".tif")),tifOpts,false);

                            theFile.saveAs((File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(m+1,3)+".jpg")),jp gOpts,true,Extension.LOWERCASE);

                          };

                     theFile.saveAs((new File(folderPath+"/"+basename+"_"+bufferNumberWithZeros(m+1,3)+".tif")),tifOpts,false);

                     theFile.close(SaveOptions.DONOTSAVECHANGES);

                     };

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

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

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

                ////// get psds, tifs and jpgs from files //////

                function getFiles (theFile) {

                    if (theFile.name.match(/\.(jpg|tif|psd|pdf|)$/i)) {

                        return true

                        };

                     };

                ////// buffer number with zeros //////

                function bufferNumberWithZeros (number, places) {

                     var theNumberString = String(number);

                     for (var o = 0; o < (places - String(number).length); o++) {

                          theNumberString = String("0" + theNumberString)

                          };

                     return theNumberString

                     };

                ////// place //////

                function placeFile (aPath) {

                // =======================================================

                var idPlc = charIDToTypeID( "Plc " );

                    var desc2 = new ActionDescriptor();

                    var idnull = charIDToTypeID( "null" );

                    desc2.putPath( idnull, new File( aPath ) );

                    var idFTcs = charIDToTypeID( "FTcs" );

                    var idQCSt = charIDToTypeID( "QCSt" );

                    var idQcsa = charIDToTypeID( "Qcsa" );

                    desc2.putEnumerated( idFTcs, idQCSt, idQcsa );

                    var idOfst = charIDToTypeID( "Ofst" );

                        var desc3 = new ActionDescriptor();

                        var idHrzn = charIDToTypeID( "Hrzn" );

                        var idRlt = charIDToTypeID( "#Rlt" );

                        desc3.putUnitDouble( idHrzn, idRlt, 0.000000 );

                        var idVrtc = charIDToTypeID( "Vrtc" );

                        var idRlt = charIDToTypeID( "#Rlt" );

                        desc3.putUnitDouble( idVrtc, idRlt, -0.000000 );

                    var idOfst = charIDToTypeID( "Ofst" );

                    desc2.putObject( idOfst, idOfst, desc3 );

                executeAction( idPlc, desc2, DialogModes.NO );

                };