Click here to Skip to main content
15,867,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have this js code I just want to change file name of merged image, in my js code when merged is completed the script is placed a new file with the name of folder name. I want to change when merge is complete a new folder create named merged_photos and merged file name with original folder name plus _merged.

please help me, I am stuck by this little issue

JavaScript
#target photoshop  
var runphotomergeFromScript = true; // must be before Photomerge include
//@includepath "/Applications/Adobe Photoshop CS5/Presets/Scripts/"
//@include "Photomerge.jsx"
//@show include

var inputFolder = Folder.selectDialog("Choose the folder containing the folders with the images to merge:");
var foldersToMerge = inputFolder.getFiles( function( file ) { return file instanceof Folder; } );

// If you want to safe the photomerge output to a user defined location, uncoment the line below.
//var outputFolder = Folder.selectDialog("Choose the folder where you want to save the merged images:");

for( var i = 0; i < foldersToMerge.length; i++ ) {
    var activeFolder= foldersToMerge[i];
    var fileList = activeFolder.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
    
    // 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 = false; // 'Vignette Removal' checkbox in dialog
    
    if( fileList.length > 1 ){
        photomerge.createPanorama(fileList,false);
        
        var tiffSaveOptions = new TiffSaveOptions();
        //tiffSaveOptions.embedColorProfile = true;
        tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
        //tiffSaveOptions.imageCompression = TIFFEncoding.NONE;
        
        if (typeof outputFolder == "undefined") {
            activeDocument.saveAs( new File(  activeFolder + '.tif'  ), tiffSaveOptions, );
        }
        else {
            activeDocument.saveAs( new File( outputFolder + '/' + activeFolder.name + '.tif'  ), tiffSaveOptions, );
        }
        activeDocument.close( SaveOptions.DONOTSAVECHANGES );
    }
};
Posted
Updated 27-Feb-16 9:04am
v2
Comments
Patrice T 27-Feb-16 13:52pm    
This have nothing to do with MergeSort
RedDk 28-Feb-16 13:58pm    
So ... Have you tried walking through the original Photomerge script using the debugger? Set breakpoints at the dialog shell outs or where user-friendly messages (strings) appear to be immanent. I find that whenever the prompt becomes an issue I wish to head off or redirect with custom message that its best to know exactly where the next action is going to take place. Read that code block there. 'Might find pieces which make sense.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900