2 Replies Latest reply on Mar 6, 2014 10:42 PM by JamesJocky

    Photomerge script - save function does not work

    ghumdinger Level 1

      Hi guys,

       

      I am using a script which I modified (by groping around in the dark because I have no scripting knowledge) from that contributed by Mike Hale on this thread: http://www.ps-scripts.com/bb/viewtopic.php?f=16&t=2782

       

      Initially I encountered fList is undefined errors, but after some tinkering, I no longer receive any errors when running the script.

       

       

      The script is meant to automate photomerge. This script is intended to operate on images in a folder by processing the images 2 at a time until the entire folder has been processed. i.e. It will apply photomerge to File 1, File 2, save, then File 3, File 4, save, and on.

       

       

      The problem -

       

      1. the save function in the script does not work. When I run the script (located in the Presets\scripts folder), it processes, but does not save.

      2. how can I modify the save function to save as a JPG file, grayscale instead?

       

       

      Many thanks,

      Jay

       

       

      The script:

       

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

      //@includepath "/c/Program Files/Adobe/Adobe PhotoshopCS5 (64 bit)/Presets/Scripts/"
      //@include "Photomerge.jsx"
      //@show include


      var workFolder = Folder.selectDialog();
      var fList = workFolder.getFiles( '*.*' );

      // 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 = false;
      // 'Bend Images Together' checkbox in dialog

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

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

      if( fList.length > 1 ){
      fList.sort();// add array sort
      while( fList.length >= 2 ){
      var tempFileArray = fList.splice(0,2);
      photomerge.createPanorama( tempFileArray, false );
      }
      app.activeDocument.flatten();
      app.activeDocument.bitsPerChannel = BitsPerChannelType.EIGHT;

      function SaveAsTIFF( inFileName, inEmbedICC, inLZW ) {
      var tiffSaveOptions = new TiffSaveOptions();
      tiffSaveOptions.embedColorProfile = inEmbedICC;
      if ( inLZW == true ) {
      tiffSaveOptions.imageCompression =
      TIFFEncoding.TIFFLZW;
      } else {
      tiffSaveOptions.imageCompression = TIFFEncoding.NONE;
      }
      app.activeDocument.saveAs( File( inFileName ),
      tiffSaveOptions );
      }
      }