Copy link to clipboard
Copied
Hi everyone, hope you are all well!
I have been assigned to make layoutfiles from scanned contactsheets.
This process, if done manually, is very time consuming.
My current workflow is the following:
1. Open up contactsheet
2. Make selection of first image on contactsheet
3. Crop
4. Save as new file
5. Go one step back
6. Make selection of next image
7. Crop
8. Save as new file
And then just eat sleep repeat... I am currently doing this to a lot of contactsheet.
Does anyone have any sugestions to a better workflow?
I thought of a possible script where I could manually select all images in the ps file and then export all of these selections as individual files. Would this be possible?
I have a lot more to go so I am available if there are any questions to the process..
I hope anyone out there can help me.
Kind regards
Magny, dk
Here is a script to save each path defined area as a separate PSD file.
Here you can see that each path defines the area to crop and save as an image:
Here are thumbs of the original file and the output:
/*
Save Multiple Path Defined Areas As Separate Files.jsx
Stephen Marsh
v1.0 - 27th August 2025: Initial release
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-export-multiple-images-from-image-selection-in-psd/td-p/15472805
*/
#target photos
...
Copy link to clipboard
Copied
You can select each contact sheet image, then Ctrl/Cmd + Shift + J to a new layer, then go back to the original layer and reapeat. Then select all the required layers in the layers panel, right-click and then Export As, or use Export Layers to Files or other scripts to do the same.
For scripting, yes, the multiple selections can be converted to a path, then a script can then identify and work with each path separately. Here's an example that could be modified:
That being said, have you looked at fhe Crop & Straighten Photos command as an alternative (hopefully it will not try to straighten)?
Copy link to clipboard
Copied
Hi
Yes, I tried the Crop & Straighten Photos command and it is quite random. So that is not the answer..
Thank you for the tip on exporting the layers..
I think I will have to go with that solution as I have not been able to get the script to work properly.
Kind regards
Magny
Copy link to clipboard
Copied
That script was just an example of the general concept, it would require modifications for your particular case.
Can you provide one or more examples of the files that you're working on?
Is the layout consistent? Do all of the contact sheets have the same number of columns and rows and the same size thumbnails and orientation?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This isn't something that can be easily automated like the simpler coins scan example.
I can see this working as a semiautomatic process if you manually add a separate closed pen tool rectangle path on each image, then run a script to save each to file based on the paths. Or perhaps using a vector shape tool rectangle where each separate shape layer defines each image.
The crooked images would also be problematic, do you just crop without rotating or do these outliers need rotation?
Copy link to clipboard
Copied
Here is a script to save each path defined area as a separate PSD file.
Here you can see that each path defines the area to crop and save as an image:
Here are thumbs of the original file and the output:
/*
Save Multiple Path Defined Areas As Separate Files.jsx
Stephen Marsh
v1.0 - 27th August 2025: Initial release
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-export-multiple-images-from-image-selection-in-psd/td-p/15472805
*/
#target photoshop
if (!documents.length) {
alert("A document must be open to run this script!");
exit();
}
var origDoc = app.activeDocument;
var normalPaths = [];
// Determine save folder: use doc path or default to desktop
var saveFolder;
if (origDoc.fullName) {
saveFolder = origDoc.fullName.parent;
} else {
saveFolder = Folder.desktop;
}
// Collect all normal paths
for (var i = 0; i < origDoc.pathItems.length; i++) {
var path = origDoc.pathItems[i];
if (path.kind == PathKind.NORMALPATH) {
normalPaths.push(path);
}
}
if (normalPaths.length === 0) {
alert("Script aborted - no saved normal paths found!");
exit();
}
var savedCount = 0;
// Loop through each path and process
for (var j = 0; j < normalPaths.length; j++) {
var pathName = normalPaths[j].name;
var tempDoc = origDoc.duplicate();
tempDoc = app.activeDocument;
try {
tempDoc.pathItems.getByName(pathName).select();
} catch (e) {
alert("Could not select path: " + pathName);
tempDoc.close(SaveOptions.DONOTSAVECHANGES);
continue;
}
setSelectionToActivePath();
crop();
removeAllPaths(tempDoc);
// Sequential numbering padded to 3 digits
var seqNum = ("000" + (savedCount + 1)).slice(-3);
var docBaseName = origDoc.name.replace(/\.[^\.]+$/, ""); // Remove extension
var savePSDName = File(saveFolder + "/" + docBaseName + "_Image_" + seqNum + ".psd");
// Save
savePSD(savePSDName);
savedCount++;
tempDoc.close(SaveOptions.DONOTSAVECHANGES);
}
// End of script notification
app.beep();
alert("Script completed!" + "\n" + savedCount + " PSD files saved to:" + "\n" + saveFolder.fsName);
///// Functions /////
function setSelectionToActivePath() {
try {
var c2t = function (s) { return app.charIDToTypeID(s); };
var s2t = function (s) { return app.stringIDToTypeID(s); };
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
var reference2 = new ActionReference();
reference.putProperty(s2t("channel"), s2t("selection"));
descriptor.putReference(c2t("null"), reference);
reference2.putEnumerated(s2t("path"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("to"), reference2);
descriptor.putInteger(s2t("version"), 1);
descriptor.putBoolean(s2t("vectorMaskParams"), true);
executeAction(s2t("set"), descriptor, DialogModes.NO);
} catch (e) {
alert("Selection from path function error: " + e);
}
}
function crop() {
try {
var s2t = function (s) { return app.stringIDToTypeID(s); };
var descriptor = new ActionDescriptor();
descriptor.putBoolean(s2t("delete"), true);
executeAction(s2t("crop"), descriptor, DialogModes.NO);
} catch (e) {
alert("Crop function error: " + e);
}
}
function removeAllPaths(doc) {
try {
for (var i = doc.pathItems.length - 1; i >= 0; i--) {
doc.pathItems[i].remove();
}
} catch (e) {
alert("Error removing paths: " + e);
}
}
function savePSD(saveFile) {
var psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
psdSaveOptions.spotColors = true;
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Find more inspiration, events, and resources on the new Adobe Community
Explore Now