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

Layers - Creating Layers

Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

I have two separate folders on my desktop
One contains 50 photos all in the JPEG format
The other contains 50 photos in the PSD format
 
I have been embedding photos one at a time using FILE - PLACE EMBEDDED - PLACE - SAVE.
in order to establish each photo as a LAYER.
 
Is there a way to transfer or copy all 50 photos into photoshop all at once and at the same time, create
a layer for each individutal photo?  
TOPICS
Windows

Views

488

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
Adobe
Community Expert ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

You would need to Adobe this with a script. Are you adding all 50 jpgs to each 50 psd files, or is just one jpg going in each pad file? There have been some other post about doing this.

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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

50 different JPEGs and 50 different PSDs.  I want to send them from my desktop into Photoshop and simulateously creating a layer for each photo.  As mentioned  earlier, I am doing this one at a time and it is a bit tedious.  Thanks

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 ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

@JoelGlobal 

 

I already have a script made for stacking a folder of files into separate layers as linked smart objects. Here it is:

 

/*
Stacker - Place Linked.jsx
Stephen Marsh, v1.0
*/

#target photoshop

if (app.documents.length === 0) {
    (function () {
        var savedDisplayDialogs = app.displayDialogs;
        app.displayDialogs = DialogModes.NO;
        var origUnits = app.preferences.rulerUnits;
        app.preferences.rulerUnits = Units.PIXELS;

        var inputFolder = Folder.selectDialog('Please select the input folder:');
        if (inputFolder === null) {
            app.beep();
            return;
        }

        var inputFiles = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|png|psd|psb|gif)$/i);
        // inputFiles.sort().reverse;
        inputFiles.sort();

        app.displayDialogs = DialogModes.NO;

        var baseDoc = open(inputFiles[0]);
        var baseDoc = activeDocument;
        baseDoc.duplicate("Stacker", false);
        baseDoc.close(SaveOptions.DONOTSAVECHANGES);

        for (var i = 0; i < inputFiles.length; i++) {
            placeFile(new File(inputFiles[i]), true, 0, 0);
            // Remove the filename extension from the layer name
            activeDocument.activeLayer.name = inputFiles[i].name.replace(/\.[^\.]+$/, '');
            //align2SelectAll('AdCH');
            //align2SelectAll('AdCV');
        }

        activeDocument.activeLayer = activeDocument.backgroundLayer;
        activeDocument.activeLayer.remove();

        //app.runMenuItem(stringIDToTypeID("selectAllLayers"));
        //reverseLayerStack();
        app.beep();
        alert(inputFiles.length + ' files stacked!');
        app.displayDialogs = savedDisplayDialogs;
        app.preferences.rulerUnits = origUnits;


        // Functions

        function placeFile(null2, linked, horizontal, vertical) {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var AD = new ActionDescriptor();
            AD.putInteger(s2t("ID"), 1);
            AD.putPath(s2t("null"), null2);
            AD.putBoolean(s2t("linked"), linked); // false for embedded
            AD.putEnumerated(s2t("freeTransformCenterState"), s2t("quadCenterState"), s2t("QCSAverage"));
            AD.putUnitDouble(s2t("horizontal"), s2t("pixelsUnit"), horizontal);
            AD.putUnitDouble(s2t("vertical"), s2t("pixelsUnit"), vertical);
            AD.putObject(s2t("offset"), s2t("offset"), AD);
            executeAction(s2t("placeEvent"), AD, DialogModes.NO);
        }

        function reverseLayerStack() {
            var idreverse = stringIDToTypeID("reverse");
            var desc4653 = new ActionDescriptor();
            var idnull = stringIDToTypeID("null");
            var ref2335 = new ActionReference();
            var idlayer = stringIDToTypeID("layer");
            var idordinal = stringIDToTypeID("ordinal");
            var idtargetEnum = stringIDToTypeID("targetEnum");
            ref2335.putEnumerated(idlayer, idordinal, idtargetEnum);
            desc4653.putReference(idnull, ref2335);
            executeAction(idreverse, desc4653, DialogModes.NO);
        }

        function align2SelectAll(method) {
            /*
            AdLf = Align Left
            AdRg = Align Right
            AdCH = Align Centre Horizontal
            AdTp = Align Top
            AdBt = Align Bottom
            AdCV = Align Centre Vertical
            */
            app.activeDocument.selection.selectAll();
            var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
            desc.putReference(charIDToTypeID("null"), ref);
            desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));
            try {
                executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
            } catch (e) {}
            app.activeDocument.selection.deselect();
        }
    })();

} else {
    alert('Please close all open files before running this script...');
}

 

I'll update it to create embedded smart object layers and post the update in a separate reply.

 

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 Expert ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

@JoelGlobal – Here is the updated script for embedding.

 

Although I only needed to change a single entry of true to false, I decided to post the entire script rather than provide instructions for changing the previous script (there was a hint in the code comments).

 

There are "latent" options in the script to align all of the layers (top left, centre etc) or to reverse the layer order. The script removes the filename extension, so original-file.jpg would have a layer name of original-file – it is easy enough to change this if you prefer to have the extension in the layer as a reference.

 

/*
Stacker - Place Embedded.jsx
Stephen Marsh, v1.0
https://community.adobe.com/t5/photoshop-ecosystem-discussions/layers-creating-layers/td-p/13252109
*/

#target photoshop

if (app.documents.length === 0) {
    (function () {
        var savedDisplayDialogs = app.displayDialogs;
        app.displayDialogs = DialogModes.NO;
        var origUnits = app.preferences.rulerUnits;
        app.preferences.rulerUnits = Units.PIXELS;

        var inputFolder = Folder.selectDialog('Please select the input folder:');
        if (inputFolder === null) {
            app.beep();
            return;
        }

        var inputFiles = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|png|psd|psb|gif)$/i);
        // inputFiles.sort().reverse;
        inputFiles.sort();

        app.displayDialogs = DialogModes.NO;

        var baseDoc = open(inputFiles[0]);
        var baseDoc = activeDocument;
        baseDoc.duplicate("Stacker", false);
        baseDoc.close(SaveOptions.DONOTSAVECHANGES);

        for (var i = 0; i < inputFiles.length; i++) {
            placeFile(new File(inputFiles[i]), false, 0, 0);
            // Remove the filename extension from the layer name
            activeDocument.activeLayer.name = inputFiles[i].name.replace(/\.[^\.]+$/, '');
            //align2SelectAll('AdCH');
            //align2SelectAll('AdCV');
        }

        activeDocument.activeLayer = activeDocument.backgroundLayer;
        activeDocument.activeLayer.remove();

        //app.runMenuItem(stringIDToTypeID("selectAllLayers"));
        //reverseLayerStack();
        app.beep();
        alert(inputFiles.length + ' files stacked!');
        app.displayDialogs = savedDisplayDialogs;
        app.preferences.rulerUnits = origUnits;


        // Functions

        function placeFile(null2, linked, horizontal, vertical) {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var AD = new ActionDescriptor();
            AD.putInteger(s2t("ID"), 1);
            AD.putPath(s2t("null"), null2);
            AD.putBoolean(s2t("linked"), linked); // false for embedded
            AD.putEnumerated(s2t("freeTransformCenterState"), s2t("quadCenterState"), s2t("QCSAverage"));
            AD.putUnitDouble(s2t("horizontal"), s2t("pixelsUnit"), horizontal);
            AD.putUnitDouble(s2t("vertical"), s2t("pixelsUnit"), vertical);
            AD.putObject(s2t("offset"), s2t("offset"), AD);
            executeAction(s2t("placeEvent"), AD, DialogModes.NO);
        }

        function reverseLayerStack() {
            var idreverse = stringIDToTypeID("reverse");
            var desc4653 = new ActionDescriptor();
            var idnull = stringIDToTypeID("null");
            var ref2335 = new ActionReference();
            var idlayer = stringIDToTypeID("layer");
            var idordinal = stringIDToTypeID("ordinal");
            var idtargetEnum = stringIDToTypeID("targetEnum");
            ref2335.putEnumerated(idlayer, idordinal, idtargetEnum);
            desc4653.putReference(idnull, ref2335);
            executeAction(idreverse, desc4653, DialogModes.NO);
        }

        function align2SelectAll(method) {
            /*
            AdLf = Align Left
            AdRg = Align Right
            AdCH = Align Centre Horizontal
            AdTp = Align Top
            AdBt = Align Bottom
            AdCV = Align Centre Vertical
            */
            app.activeDocument.selection.selectAll();
            var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
            desc.putReference(charIDToTypeID("null"), ref);
            desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));
            try {
                executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
            } catch (e) {}
            app.activeDocument.selection.deselect();
        }
    })();

} else {
    alert('Please close all open files 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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

So sorry to say I would not know what to do with a srcipt.  Iwas looking for the "clicks" within theprogram that would accomplish this.

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 ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

quote

So sorry to say I would not know what to do with a srcipt.  Iwas looking for the "clicks" within theprogram that would accomplish this.


By @JoelGlobal

 

That is common. So common that I wrote a blogpost about it and included the link after the first script:

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

 

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
New Here ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

Great script, I would like to use it but it don't work with my 1-bit tiff's.

Can You be so kind and help me making it work?

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 ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

Yet another option, a three-step approach, is to use the default script that ships with Photoshop:

 

File > Scripts > Load Files Into Stack (don't tick the smart object box)... Then, use Select > All Layers.

 

Finally, use one of the following custom scripts to convert all selected layers into an individual smart object layer:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-that-converts-layers-to-separa...

 

Or this one:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/smart-objects-in-separate-layers/td-p...

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 ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

LATEST

I have added a third version of the Stacker script that doesn't use smart objects:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/combining-tiffs/m-p/13475955

 

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