Copy link to clipboard
Copied
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.
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
Copy link to clipboard
Copied
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
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...');
}
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.
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.
By @JoelGlobal
That is common. So common that I wrote a blogpost about it and included the link after the first script:
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
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?
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:
Or this one:
Copy link to clipboard
Copied
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