• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Place Embedded one sequence to another sequence

Community Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Hi,

I have two folders with 1000 frames each, what i want to do is maybe with a script perhaps.

So in Photoshop i want the first frame of the folder A to be open, and then place embedded the first frame of the folder B

and then for the second frame of the folder A to be open, and then place embedded the second frame of the folder B, etc.

after the embedded layer has taken place, i want to rasterize, it rename it and delete the second layer from the top (each file of the folder A has many layers but i want tonly to replace the first layer with the accordinate file of folder B).

Is there any script that does this job in PS?

TOPICS
Actions and scripting , Windows

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 30, 2021 Apr 30, 2021

Try this alternative version. Please let me know if this works as expected...

 

 

// ATTENTION: USE AT YOUR OWN RISK, WORK ON COPIES OF ORIGINALS, YOU HAVE BEEN WARNED!

/*
https://community.adobe.com/t5/photoshop/place-embedded-one-sequence-to-another-sequence/m-p/11998160
Place Embedded one sequence to another sequence

EXR RGBA Merge Script.jsx
Version 1.1B - 1st May 2021

Stephen Marsh
*/

#target photoshop

    (function () {

        if (app.documents.length === 0) {

            // Save t
...

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

I can not even follow what you wrote. So I do not understand what your trying  to create or accomplish. No image files seem to saved in your processing. Some frame files  sizes not disclosure are place in on top of some other open frame file canvas  rasterized renamed and deleted.  I'm sure such a process you would need to script yourself.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

You mean the attched images of the process are not displaying here in the forum?

These are the steps of what i want to do in one file and then repeat it to the rest thousand frames

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Well the main thing i want to achieve is to embedd in each frame of the first folder onto the coresspondig frame of the other folder, then i will try with actions perhaps to rasterize and rename the new layer that has been embedded

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

At what point do you want to save the file and in what file type? It seems that you could just use the placed smart object, then replace the contents for each file, rather than adding a new embedded file then deleting the previous file. Why the need to rasterize?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

ok maybe i didnt clrfy it correctly.

Here are the steps of the process:

1) Open the first frame of the sequence A it is .exr (and has several layers inside-passes of a render specular, refraction etc.) with tis order:

RGBA,

Specular,

AO,

Refraction

2) Place embedded on the file of step1 the fisrt frame of the sequence B it is also .exr but only with one layer

3) Now i have in the first frame of the sequence A another layer on top of the existing layer which is basically the file from step2

4)so the layers now in the first file of step 1 are like this from top to bottom:

first frame of sequenceB,

RGBA,

Specular,

AO,

Refraction

5)renaming the first layer as RGBA so now this is the order:

RGBA,

RGBA,

Specular,

AO,

Refraction

6) delete the second layer RGBA (the old one) and now this is the order:

RGBA,

Specular,

AO,

Refraction

7)save the file as it is overwrite

8)make all the above for the second, third frame of the sequence etc., if all the above is scripted then i think i can run this script with batch to all 1000 frames

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

That seem like a designed process you came up with on your own not some standard process that may have been automated by others.  You would need to develop the Photoshop Script if you want your process automated. Do you have any programming skills?

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

No unfortunatelly not

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Curious minds want to know:

 

* Will each doc in Folder A always have 4 layers? If so, will all 4 layers always be in the same order and have the same unique layer names?

 

* Will each doc in Folder B always have 4 layers? If so, will all 4 layers always be in the same order and have the same unique layer names?

 

In other words, how consistent is the layer structure in length/count and naming between the docs in both folders? Can I presume that there are no layer sets/groups or Background layer?

 

* Would it be acceptable to directly replace the content of the layer in Folder A with the layer from Folder B? There are multiple steps in your proposal that could be streamlined.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Hi,

to answer your questions:

1) yes each doc of folder A always have 4 layers with same order and always have the same unique layer names

2)Each doc from folder B has only one layer named RGBA

 

no layer sets ot groups or background layer exist

 

3) the layer from each doc from folder B needs to be placed on top of the layers from each doc of folder A

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Thank you for confirming. I still question point #3 though.

 

Place RGBA layer from Doc 2 above RGBA layer in Doc 1 as smart object, rasterize, rename then delete the original RGBA layer.

 

I get it, is step by step and logical as far as it goes...

 

However, if there was a way to reduce the steps and end up with the same result, wouldn't that be better?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Of course and it would be better but how?

this is exactly what i want to do, but if there is way to do it better and faster i would like to know

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

One last lot of questions for now...

 

Is the modified Doc 1 saved/replaced/overwritten – or should a new file be created with no changes made to the original Doc 1?

 

Doc 2 can be closed with saving once it has served it's purpose?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Yes Doc1 will be saved/replaced/overwritten

and yes Doc2  can be closed when it has served it's purpose

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

 

OK, you can try the following script...

 

Original files will be overwritten and closed, personally, I'd prefer to save the files to a different location and or with a different filename so that the originals are not overwritten... so:

 

WORK ON COPIES OF THE ORIGINALS, USE AT YOUR OWN RISK... YOU HAVE BEEN WARNED!

 

I had to test on layered PSD files as Photoshop 32 bpc .exr files only had one layer? My background is print, not video so I don't have any experience with this file format.

 

 

// ATTENTION: USE AT YOUR OWN RISK, WORK ON COPIES OF ORIGINALS, YOU HAVE BEEN WARNED!

/*
https://community.adobe.com/t5/photoshop/place-embedded-one-sequence-to-another-sequence/m-p/11998160
Place Embedded one sequence to another sequence

EXR RGBA Merge Script.jsx
Version 1.0 29th April 2021

Stephen Marsh
*/

#target photoshop

    (function () {

        if (app.documents.length === 0) {

            // Save the current dialog display settings
            var savedDisplayDialogs = app.displayDialogs;
            app.displayDialogs = DialogModes.NO;

            // Input folder 1
            var folder1 = Folder.selectDialog("Please select folder A");
            if (folder1 === null) return;

            // Input folder 2
            var folder2 = Folder.selectDialog("Please select folder B");
            if (folder2 === null) return;

            // Validate input folder selection
            var validateInputDir = (folder1.fsName === folder2.fsName);
            if (validateInputDir === true) {
                alert("Script cancelled as both the input folders are the same");
                return;
            }

            var searchMask = '*.???';
            var list1 = folder1.getFiles(searchMask);
            var list2 = folder2.getFiles(searchMask);
            // Alpha-numeric sort
            list1.sort();
            list2.sort();

            // Validate that folder 1 & 2 lists are not empty 
            var validateEmptyList = (list1.length > 0 && list2.length > 0);
            if (validateEmptyList === false) {
                alert("Script cancelled as one of the input folders is empty");
                return;
            }

            // Validate that the item count in folder 1 & 2 matches
            var validateListLength = (list1.length === list2.length);
            if (validateListLength === false) {
                alert("Script cancelled as the input folders don't have equal quantities of images");
                return;
            }

            // Loop through matching images from folder 1 & folder 2
            for (var i = 0; i < list1.length; i++) {
                open(list1[i]);
                placeFile(list2[i], 100);
                app.runMenuItem(stringIDToTypeID('rasterizePlaced'));
                mergeDown();
                app.activeDocument.close(SaveOptions.SAVECHANGES);
                app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
            }

            alert('Script completed!');

            // Restore the dialogs
            app.displayDialogs = savedDisplayDialogs;

            // Here be functions

            function placeFile(file, scale) {
                var idPlc = charIDToTypeID("Plc ");
                var desc2 = new ActionDescriptor();
                var idnull = charIDToTypeID("null");
                desc2.putPath(idnull, new File(file));
                var idFTcs = charIDToTypeID("FTcs");
                var idQCSt = charIDToTypeID("QCSt");
                var idQcsa = charIDToTypeID("Qcsa");
                desc2.putEnumerated(idFTcs, idQCSt, idQcsa);
                var idOfst = charIDToTypeID("Ofst");
                var desc3 = new ActionDescriptor();
                var idHrzn = charIDToTypeID("Hrzn");
                var idPxl = charIDToTypeID("#Pxl");
                desc3.putUnitDouble(idHrzn, idPxl, 0.000000);
                var idVrtc = charIDToTypeID("Vrtc");
                var idPxl = charIDToTypeID("#Pxl");
                desc3.putUnitDouble(idVrtc, idPxl, 0.000000);
                var idOfst = charIDToTypeID("Ofst");
                desc2.putObject(idOfst, idOfst, desc3);
                var idWdth = charIDToTypeID("Wdth");
                var idPrc = charIDToTypeID("#Prc");
                desc2.putUnitDouble(idWdth, idPrc, scale);
                var idHght = charIDToTypeID("Hght");
                var idPrc = charIDToTypeID("#Prc");
                desc2.putUnitDouble(idHght, idPrc, scale);
                var idAntA = charIDToTypeID("AntA");
                desc2.putBoolean(idAntA, true);
                executeAction(idPlc, desc2, DialogModes.NO);
            }

            function mergeDown() {
                var s2t = function (s) {
                    return app.stringIDToTypeID(s);
                };

                var descriptor = new ActionDescriptor();

                executeAction(s2t("mergeLayersNew"), descriptor, DialogModes.NO);
            }

        }

        else {

            alert('Please close all open documents before running this script!');

        }

    }());

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Thank you very much

Amazing it is working!!

But only for the first doc of the sequence. 

Maybe i did something wrong but the rest of them are without any changes

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Can one of the scripting regulars spot my mistake?

 

EDIT: I'll post a different version which uses an alternative method to combine the folder B images...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Try this alternative version. Please let me know if this works as expected...

 

 

// ATTENTION: USE AT YOUR OWN RISK, WORK ON COPIES OF ORIGINALS, YOU HAVE BEEN WARNED!

/*
https://community.adobe.com/t5/photoshop/place-embedded-one-sequence-to-another-sequence/m-p/11998160
Place Embedded one sequence to another sequence

EXR RGBA Merge Script.jsx
Version 1.1B - 1st May 2021

Stephen Marsh
*/

#target photoshop

    (function () {

        if (app.documents.length === 0) {

            // Save the current dialog display settings
            var savedDisplayDialogs = app.displayDialogs;
            app.displayDialogs = DialogModes.NO;

            // Input folder 1
            var folder1 = Folder.selectDialog("Please select folder A");
            if (folder1 === null) return;

            // Input folder 2
            var folder2 = Folder.selectDialog("Please select folder B");
            if (folder2 === null) return;

            // Validate input folder selection
            var validateInputDir = (folder1.fsName === folder2.fsName);
            if (validateInputDir === true) {
                alert("Script cancelled as both the input folders are the same");
                return;
            }

            var searchMask = '*.???';
            var list1 = folder1.getFiles(searchMask);
            var list2 = folder2.getFiles(searchMask);
            // Alpha-numeric sort
            list1.sort();
            list2.sort();

            // Validate that folder 1 & 2 lists are not empty 
            var validateEmptyList = (list1.length > 0 && list2.length > 0);
            if (validateEmptyList === false) {
                alert("Script cancelled as one of the input folders is empty");
                return;
            }

            // Validate that the item count in folder 1 & 2 matches
            var validateListLength = (list1.length === list2.length);
            if (validateListLength === false) {
                alert("Script cancelled as the input folders don't have equal quantities of images");
                return;
            }

            // Loop through matching images from folder 1 & folder 2
            for (var i = 0; i < list1.length; i++) {
                open(list1[i]);
                open(list2[i]);
                var doc1 = app.documents[0];
                app.activeDocument = doc1;
                app.activeDocument.layers.getByName("RGBA");
                applyImage();
                doc1.close(SaveOptions.SAVECHANGES);
                app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
            }

            alert('Script completed!');

            // Restore the dialogs
            app.displayDialogs = savedDisplayDialogs;

            function applyImage() {
                var idAppI = charIDToTypeID("AppI");
                var desc857 = new ActionDescriptor();
                var idWith = charIDToTypeID("With");
                var desc858 = new ActionDescriptor();
                var idT = charIDToTypeID("T   ");
                var ref281 = new ActionReference();
                var idChnl = charIDToTypeID("Chnl");
                var idChnl = charIDToTypeID("Chnl");
                var idRGB = charIDToTypeID("RGB ");
                ref281.putEnumerated(idChnl, idChnl, idRGB);

                var idLyr = charIDToTypeID("Lyr ");
                var srcLayerName = app.documents[1].layers[0].name;
                ref281.putName(idLyr, srcLayerName);

                var idDcmn = charIDToTypeID("Dcmn");
                var srcDocName = app.documents[1].name;
                ref281.putName(idDcmn, srcDocName);

                desc858.putReference(idT, ref281);
                var idClcl = charIDToTypeID("Clcl");
                desc857.putObject(idWith, idClcl, desc858);
                executeAction(idAppI, desc857, DialogModes.NO);
            }

        } else {

            alert('Please close all open documents before running this script!');

        }

    }());

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Thank you very very much,

it is working perfectly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

LATEST

Your welcome!

 

EDIT: I have made a minor update to the code.

 

It's driving me crazy trying to work out why the first script isn't working as intended. I'm glad that the second one works!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines