I have created a Photoshop Script (using JavaScript) for batch creation of HDR images.
I have used previous discussions during implementation.
In the beginning part of the script there are some options that you can change to customize the script's operation.
You are free to modify this script and publish your modifications.
The script can be found at the following URL (which is a git repository in itself) , and is also pasted below.
https://gist.github.com/1640233
// Batch Creation of HDR files
// -----------------------------------------------------------------------------------
// Opens a dialog box, asking for the container folder.
// The container folder must have separate sub folders for each of the HDR image series
// The output can be saved in a subfolder with an arbitrary name by
// changing the options below.
//
// example: to save hdr files as
// C:\container\hdrseries1\myhdrfolder\myhdr.psd
// change the options HDROutputFolder to "myhdrfolder"
// and option HDRFileName to "myhdr"
//
// Extensions of source image files
var pictureExtensions = "*.jpg";
// Sub-folder to save the resulting HDR file. This folder will be created if it does not exist.
//var HDROutputFolder = ""; // disable subfolder like this
var HDROutputFolder = "HDR"
// Filename for saved HDR file. Do not set the extension here, extension is set automatically according to saveResultAsEXR option.
var HDRFileName = "HDR";
// Save EXR file (requires EXR plugin) If set to "false" saves the HDR as a .PSD file
var saveResultAsEXR = false;
// Overwrite existing HDR output files? If set to "false" skips creating HDR files for already created image sets.
// This is useful for adding some new HDR sets into the container folder, and running the script again
// to crate HDR files only for the newly added series.
var overwriteExistingHDR = false;
// --------------- End of settings ------------------- //
var runMergeToHDRFromScript = true;// define and set to true before including Merge To HDR.jsx
var g_ScriptFolderPath = app.path + "/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts");
var g_ScriptPath = File( g_ScriptFolderPath+'/Merge To HDR.jsx' );
$.evalFile( g_ScriptPath );
// function to manually save an EXR file. Requires EXR plugn to be installed
function saveEXR(saveFile){
var idsave = charIDToTypeID( "save" ); var desc6 = new ActionDescriptor(); var idAs = charIDToTypeID( "As " ); desc6.putString( idAs, "OpenEXR" ); var idIn = charIDToTypeID( "In " ); desc6.putPath( idIn, saveFile ); executeAction( idsave, desc6, DialogModes.NO );
}
function main()
{
var bracket_folders = []; var selected_folder = Folder.selectDialog ("Select the container folder. The container folder should have a separate folder inside for each HDR image series.") if (selected_folder != null) { // to process multiple container folders, uncomment following line and edit folder paths. //bracket_folders = [ Folder('/c/images/bracket5'), Folder('/c/images/bracket9')]; bracket_folders = bracket_folders.concat(selected_folder); for (var f = 0; f < bracket_folders.length; f++) { var image_folders = bracket_folders[f].getFiles(); for (var g = 0; g < image_folders.length; g++) { var folder = image_folders[g]; var filelist = image_folders[g].getFiles(pictureExtensions); var photoshopHDRFolder = Folder(folder.absoluteURI + "/" + HDROutputFolder); if (saveResultAsEXR) { var extension = ".exr"; } else { var extension = ".psd"; } var photoshopHDRFile = File(photoshopHDRFolder.absoluteURI + "/" + HDRFileName + extension); if (overwriteExistingHDR ==false && photoshopHDRFile.exists == true) { continue; } mergeToHDR.useAlignment = true; mergeToHDR.outputBitDepth= 32; mergeToHDR.mergeFilesToHDR( filelist, true, -2 ); if (photoshopHDRFolder.exists == false) { photoshopHDRFolder.create(); } if (saveResultAsEXR) { saveEXR(photoshopHDRFile); } else { activeDocument.saveAs(photoshopHDRFile ); // Use for PSD files } activeDocument.close(SaveOptions.DONOTSAVECHANGES); } } }
}
main();