1 Reply Latest reply on Jun 12, 2018 2:19 PM by sidpalas

    Error 27: Stack Overrun (present when line does not exist)


      Hello, I am trying to finish this photoshop script that automates image stitching. I am encountering a strange error - error 27: stack overrun. I've read from other forums that this may occur during a loop when it repeatedly calls itself. In this case the code is just naming the file, and is not part of the preceding loop (unless the file is being continuously and opened and saved, but that doesn't appear to be correct).


      In order to try and look into this further I deleted the line entirely, saved the document, and ran the script again. I still got the same error. Does anyone have an idea about what may be happening? The problem is on line 37.


      I am running photoshop cc 2015, on a Windows 10 computer.




      //This will be the direcotry of the images  
      var workFolder = Folder("C:\\Users\\Kevin\\Desktop\\batchmerge");  
      var folders = workFolder.getFiles();   
      runphotomergeFromScript = true;  
      $.evalFile("C:\\Program Files\\Adobe\\Adobe Photoshop CC 2018\\Presets\\Scripts\\batchmerge.jsx");  
      psdOpts = new PhotoshopSaveOptions();   
      psdOpts.embedColorProfile = true;   
      psdOpts.alphaChannels = true;   
      psdOpts.layers = false;   
      tiffOpts = new TiffSaveOptions();  
      psdOpts.layers = false;  
      for( var i = 0; i < folders.length; i++ )   
           if (folders[i] instanceof Folder){  
        var folder = folders[i];   
        var fList = folder.getFiles( '*.tif' );  
         // 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      
         photomerge.advancedBlending      = true; // '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 )  
          var doc_name = fList[0].name;  
          var final_name = doc_name.slice(0,-6);    
          activeDocument.saveAs( new File(flist[0].parent+'/'+final_name+'.psd'), psdOpts, true, Extension.LOWERCASE);
          activeDocument.saveAs( new File(workFolder.parent+'/'+final_name+'.tif') , tiffOpts, true, Extension.LOWERCASE);   
          activeDocument.close( SaveOptions.DONOTSAVECHANGES );