forked from HaydenElza/whi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctioningScript.jsx
More file actions
58 lines (47 loc) · 2.22 KB
/
FunctioningScript.jsx
File metadata and controls
58 lines (47 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#target photoshop;
var runphotomergeFromScript = true; // must be before Photomerge include
$.evalFile(app.path + "/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts") + "/Photomerge.jsx");
//@show include
psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;
var workFolder = Folder.selectDialog();
var folders = workFolder.getFiles( function( file ) { return file instanceof Folder; } );
for( var i = 0; i < folders.length; i++ )
{
var folder = folders[i];
var fList = folder.getFiles( '*.tif' );
// override Photomerge.jsx settings. Default rtgris "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 = true; // 'Vignette Removal' checkbox in dialog
if( fList.length > 1 )
{
photomerge.createPanorama(fList,false);
}
// The merged doc will be the activeDocument
// activeDocument.saveAs( new File( fList[0].parent + '/Stitch.psb' ) , psdOpts, true, Extension.LOWERCASE);
// try to always save as psb for larger files
savePSB(fList[0].parent + '/Stitch.psb');
activeDocument.close( SaveOptions.DONOTSAVECHANGES );
}
function savePSB(fileNameAndPath)
{
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc19 = new ActionDescriptor();
var desc20 = new ActionDescriptor();
desc20.putBoolean( sTID('maximizeCompatibility'), true );
desc19.putObject( cTID('As '), cTID('Pht8'), desc20 );
desc19.putPath( cTID('In '), new File( fileNameAndPath ) );
desc19.putBoolean( cTID('LwCs'), true );
executeAction( cTID('save'), desc19, DialogModes.NO );
};