Skaliert alle geöffneten Bilder im Photoshop auf einen vorgegebene gemeinsame Breite.
Beispiel: Will man mehrere unterschiedlich formatierte (breit- und hochformatige) Bilder auf einer Website platzieren und hat dazu 900 Pixel in der Breite, kann dieses Script alle Bilder auf eine gemeinsame Höhe und der gegebenen Breite skalieren.

//####################################################################
//
// Arrange / resize images (same height) to a given total width
// Photoshop Script (CS2, tested on PC)
//
//####################################################################
// save the current preferences & settings
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// main script
var docs = app.documents;
var openDocs = docs.length;
var totalWidth = prompt('Total available width:', '500');
var spareWidth = prompt('Gap between pictures:', '0');
var totalSpare = spareWidth * (openDocs-1);
totalWidth = totalWidth - totalSpare;
// get height of all images and store in array
var imgSize = new Array();
for (var i=0; i<openDocs; i++) {
app.activeDocument = docs[i];
imgSize[i] = new ent(i, app.activeDocument.height);
}
// sort 2-dim. array -> http://www.webmasterbiz.de/showthread.php?t=618
imgSize.sort(cmpnum);
var smallestCommonHeight = imgSize[0].height;
var totalOriginalWidth = 0;
// all images resize to smallestCommonHeight
for (var i=0; i<openDocs; i++) {
app.activeDocument = docs[i];
app.activeDocument.resizeImage(null, smallestCommonHeight, null, ResampleMethod.BICUBIC)
totalOriginalWidth = totalOriginalWidth + app.activeDocument.width;
}
var summary = "Summary:\n";
var resizeValue = totalWidth / totalOriginalWidth;
// all images resize to the right width
for (var i=0; i<openDocs; i++) {
app.activeDocument = docs[i];
var newWidth = app.activeDocument.width * resizeValue;
app.activeDocument.resizeImage(newWidth, null, null, ResampleMethod.BICUBIC)
summary = summary + app.activeDocument.name + ": " +
app.activeDocument.width + " / " +
app.activeDocument.height + "\n";
}
// restore settings
app.preferences.rulerUnits = startRulerUnits;
app.preferences.typeUnits = startTypeUnits;
app.displayDialogs = startDisplayDialogs;
// finish!
alert(summary);
// array -> http://www.webmasterbiz.de/showthread.php?t=618
function ent(imgnr, height) {
this.imgnr = imgnr;
this.height = height;
}
// sort array by height
function cmpnum(inp1, inp2) {
return inp1.height - inp2.height;
}