Skip to main content
mirza5313
Known Participant
February 27, 2016
Question

photoshop js code for imagemerege

  • February 27, 2016
  • 1 reply
  • 1762 views

I have this js code i want to change the code that this code create a new merged file with the name of folder that content images i actually want to create a new folder named "merged_photos" and in that folder a new merged image named as folder name and after folder name just add "_merged"

please help me

#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;

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 + _merged + '.tif'  ), tiffSaveOptions, );

}

activeDocument.close( SaveOptions.DONOTSAVECHANGES );

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
February 27, 2016

Looking at the code it looks like the code is there you just need to uncomment it.

JJMack
mirza5313
mirza5313Author
Known Participant
February 27, 2016

but there is no code for crate new folder and i want to create new folder and named it merged_photo and place merged file on it

JJMack
Community Expert
Community Expert
February 27, 2016

The code to create a mew folder is there but commented out. Also, you did not post the complete script.  I do not have CS5 installed. I changed what is there for CS6 added some closing brackets so the incomplete code would try to run. To see If I could create a new folder with the code as posted and new folder code uncommented.  I had no problem creating a new folder for the output....

JJMack