1 Reply Latest reply on Jan 26, 2015 3:03 AM by c.pfaffenbichler

    How do I add an export to jpeg function to this batch Photomerge script?

    landscape_man

      Hi, I have got my hands on a Photoshop script which will run batches of photos through photomerge and then save to a psd or psb with the name in the original folder, whereas what I really need it to do is to save as a JPEG.

       

      The way it works is that you sort your images into groups of photos that need to be stitched and then place each of these into separate folders. I then give each folder a name like 'Viewpoint 1_Pano1' 'Viewpoint 1_Pano 2' 'Viewpoint 2_Pano 1' etc.  All these folders are then placed in a one folder. The script runs through that folder stitching each of the subfolders together and saving the resultant psd (or psb if the files size is too large) named 'stitch' into each subfolder.

       

      What would be great is if the script could save as a jpeg and a psd/psb each with the name of the subfolder, so for example in subfolder 'Viewpoint 1_Pano 1' you would end up with 'Viewpoint 1_Pano 1.psd' (or psb) and 'Viewpoint 1_Pano 1.jpeg'

       

      I am totally new to photoshop scripting and would really appreciate some help on this. Thank you!

       

       

       

      Script is:

       

      var runphotomergeFromScript = true; // must be before Photomerge include

      //@includepath "/c/Program Files (x86)/Adobe/Adobe Photoshop CS4/Presets/Scripts/"

      //@include "Photomerge.jsx"

      //@show include

       

       

      psdOpts = new PhotoshopSaveOptions();

      psdOpts.embedColorProfile = true;

      psdOpts.alphaChannels = true;

      psdOpts.layers = true;

       

       

       

       

      var workFolder = Folder.selectDialog();

      var folders = workFolder.getFiles( function( file ) { return file instanceof Folder; } );

       

       

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

      {

        var folder = folders[i];

        var fList = folder.getFiles( '*.jpg' );

       

       

         // override Photomerge.jsx settings. Default is "Auto". Uncomment to override the default.

         //photomerge.alignmentKey   = "Auto";

         //photomerge.alignmentKey   = "Prsp";

         photomerge.alignmentKey   = "cylindrical";

         //photomerge.alignmentKey   = "spherical";

         //photomerge.alignmentKey   = "sceneCollage";

         //photomerge.alignmentKey   = "translation"; // "Reposition" in layout dialog   

       

       

         // other setting that may need to be changed. Defaults below

         photomerge.advancedBlending      = true; // 'Bend Images Together' checkbox in dialog

         photomerge.lensCorrection      = false; // Geometric Distortion Correction'checkbox in dialog

         photomerge.removeVignette      = true; // 'Vignette Removal' checkbox in dialog

       

       

         if( fList.length > 1 )

         {

          photomerge.createPanorama(fList,false);

         }

       

       

         // The merged doc will be the activeDocument

         // activeDocument.saveAs( new File( fList[0].parent + '/Stitch.psb' ) , psdOpts, true, Extension.LOWERCASE);

       

       

        //   try to always save as psb for larger files

        savePSB(fList[0].parent + '/Stitch.psb');  

        activeDocument.close( SaveOptions.DONOTSAVECHANGES );

      }

       

       

      function savePSB(fileNameAndPath)

      {

        function cTID(s) { return app.charIDToTypeID(s); };

        function sTID(s) { return app.stringIDToTypeID(s); };

       

       

        var desc19 = new ActionDescriptor();

           var desc20 = new ActionDescriptor();

        desc20.putBoolean( sTID('maximizeCompatibility'), true );

        desc19.putObject( cTID('As  '), cTID('Pht8'), desc20 );

          desc19.putPath( cTID('In  '), new File( fileNameAndPath ) );

          desc19.putBoolean( cTID('LwCs'), true );

          executeAction( cTID('save'), desc19, DialogModes.NO );

      };