0

I found this one and I´m not confirm with scripting. But perhaps this would be a part of my search for stitching out of Phase One Capture One 12. Multiple Panorama Automation in Photoshop

Capture One cannot create Panorama or Focus Stacks. So I will try, to open the Pictures in Photoshop to stitch. But Photoshop 2020 open all images separate and I cannot run the stitching process. I will export the pictures and open Photoshop (or other apps) for stitching manual. Perhaps it will be possible to run a script, which starts as droplet action. It will open all export files and creates a panorama. The script Sergej designed would be ok. But what must I do and where to place or replace something in Photoshop for testing?

EDIT: It works for me with this script I´ve found here. But is it possible, to change the output name of panorama picture in to the same name as each first image (jpg) with the right file extension (e.g. .psd)? And on the end of filename "_pano". So it should be like e.g. "filename1_pano.psd"

var runphotomergeFromScript = true; // must be before Photomerge include
//@includepath "/C/Program Files/Adobe/Adobe Photoshop CC 2019/Presets/Scripts/"
//@include "Photomerge.jsx"
//@show include

var psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;

(function()
{
    var workFolder = Folder.selectDialog();
    if (workFolder == null) return false;

    var folders = workFolder.getFiles(function(file)
    {
        return file instanceof Folder;
    });

    if (folders.length == 0) return false

    for (var i = 0; i  1)
            {
                photomerge.createPanorama(fList, false);
            }
        }
        catch (e)
        {
            alert(e + '\nLine: ' + e.line)
        }
        // saving
        var saveFile = {
            name: folders[i].name,
            path: fList[0].parent
        }

        //savePSB(saveFile)
        //saveTIF(saveFile)
        //saveJPG(saveFile)
        savePSD(saveFile)

        activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    }
})()

function savePSB(data)
{
    var desc = new ActionDescriptor();
    var descCompatibility = new ActionDescriptor();
    descCompatibility.putBoolean(stringIDToTypeID('maximizeCompatibility'), true);
    desc.putObject(charIDToTypeID('As  '), charIDToTypeID('Pht8'), descCompatibility);
    desc.putPath(charIDToTypeID('In  '), new File(data.path + "/" + data.name + ".psb"));
    executeAction(charIDToTypeID('save'), desc, DialogModes.NO);
}; // end of savePSB()

function saveTIF(data)
{
    var desc = new ActionDescriptor();
    var descOptions = new ActionDescriptor();
    descOptions.putEnumerated(charIDToTypeID('BytO'), charIDToTypeID('Pltf'), charIDToTypeID('Mcnt'));
    descOptions.putEnumerated(stringIDToTypeID('layerCompression'), charIDToTypeID('Encd'), stringIDToTypeID('RLE'));
    desc.putObject(charIDToTypeID('As  '), charIDToTypeID('TIFF'), descOptions);
    desc.putPath(charIDToTypeID('In  '), new File(data.path + "/" + data.name + ".tif"));
    executeAction(charIDToTypeID('save'), desc, DialogModes.NO);
}; // end of saveTIF()

function saveJPG(data)
{
    if (data.path == undefined) return false;
    data.name = data.name == undefined ? activeDocument.name : data.name;
    data.quality == undefined && data.quality = 75

    var options = new ExportOptionsSaveForWeb(),
        jpgFile = new File(data.path + '/' + data.name + '.jpg');
    options.format = SaveDocumentType.JPEG;
    options.quality = data.quality;
    activeDocument.exportDocument(jpgFile, ExportType.SAVEFORWEB, options);
}

function savePSD(data)
{
    var desc = new ActionDescriptor();
    var descOptions = new ActionDescriptor();
    descOptions.putBoolean(stringIDToTypeID('maximizeCompatibility'), true);
    desc.putObject(charIDToTypeID('As  '), charIDToTypeID('Pht3'), descOptions);
    desc.putPath(charIDToTypeID('In  '), new File(data.path + "/" + data.name + ".psd"));
    executeAction(charIDToTypeID('save'), desc, DialogModes.NO);
} // end of savePSD()
  • To get the name to include _pano.psd, find the line data.path + "/" + data.name + ".psd" (it's the third from the bottom) and change it to data.path + "/" + data.name + "_pano.psd" – superluminal Dec 3 '19 at 18:10
  • Thanks, but this is not the really problem. I can also add name: folders[i].name + "_pano" inside the script. I will get the filename from each first file inside the folder. So I can create the panorama in batch and create a psd file with the first name and the additional "_pano.psd". So Lightroom or other organize programms will see it. Or much better: is is possible to additional delete all jpg files after processing the panorama? So there will be only the panorama file inside the folder? – Thomas Mayer Dec 4 '19 at 6:57
  • In short notes: My files are file1.jpg, file2.jpg, file3.jpg. At the moment I’m getting an output-pano.psd as the output. I want file1-pano.psd and all jpegs removed. @Sergey: this right understanding. I´m not a really good scripter. But I found some lines like which input filetype and which output files are produced. And of course, which type of stitching calculation. This is the only thing I understood. – Thomas Mayer Dec 4 '19 at 9:25
1

Here's a modified version. This will scan subfolders for jpeg files (line 28), save a panorama with a name of the first jpeg file + -pano and will remove the jpeg files in the end:

var runphotomergeFromScript = true; // must be before Photomerge include
//@includepath "/C/Program Files/Adobe/Adobe Photoshop CC 2019/Presets/Scripts/"
//@include "Photomerge.jsx"
//@show include

var psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;

(function()
{
    var workFolder = Folder.selectDialog();
    var fList, i, k, saveFile;

    if (workFolder == null) return false;

    var folders = workFolder.getFiles(function(file)
    {
        return file instanceof Folder;
    });

    if (folders.length == 0) return false

    for (i = 0; i < folders.length; i++)
    {

        fList = folders[i].getFiles('*.jpg');

        // 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 = false; // 'Blend Images Together' checkbox in dialog
        photomerge.lensCorrection = false; // Geometric Distortion Correction'checkbox in dialog
        photomerge.removeVignette = false; // 'Vignette Removal' checkbox in dialog

        try
        {
            if (fList.length > 1)
            {
                photomerge.createPanorama(fList, false);
            }
        }
        catch (e)
        {
            alert(e + '\nLine: ' + e.line)
        }
        // saving
        saveFile = {
            name: fList[0].name.replace(/\.[^.]+$/g, "") + "-pano",
            path: fList[0].parent
        }

        savePSD(saveFile);

        for (k = 0; k < fList.length; k++) {
          fList[k].remove();
        }

        activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    }
})()

function savePSD(data)
{
    var desc = new ActionDescriptor();
    var descOptions = new ActionDescriptor();
    descOptions.putBoolean(stringIDToTypeID('maximizeCompatibility'), true);
    desc.putObject(charIDToTypeID('As  '), charIDToTypeID('Pht3'), descOptions);
    desc.putPath(charIDToTypeID('In  '), new File(data.path + "/" + data.name + ".psd"));
    executeAction(charIDToTypeID('save'), desc, DialogModes.NO);
} // end of savePSD()
| improve this answer | |
  • Thank you Sergey... this another script like my basic here on top. Your script ends with an error Line 55 save File. Is it possible you modify the script on top of my thread here? So I can easy change outputs from PSD,JPG,TIF,PSB? – Thomas Mayer Dec 4 '19 at 14:02
  • What error? For me it works fine. Your script on top of the thread misses some code, it's not going to work. – Sergey Kritskiy Dec 4 '19 at 14:11
  • OK... there was a copy mistake of your code to my merge.jsx. Now it works. Great and big thanks!!! I can modify this script now for PSD input too and it works! Lucky man!!! But my script on top works also? I have found this on another thread here. But for me, your new one works fine. – Thomas Mayer Dec 4 '19 at 14:49
  • Your script on top doesn't work, you probably deleted several lines accidentally while you were posting it. Please don't forget to accept the answer to close the question. – Sergey Kritskiy Dec 4 '19 at 14:52
  • ok. how to close the question? It works... Big thanks to you. – Thomas Mayer Dec 4 '19 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.