Hi,
I've been away for some time... good to be back.
I need to batch a good number of thumbnails for a website.
What I need are square 75x75 thumbnails make of various different image dimensions 640x480 and 480x640.
I found some PS scripts on the internet but they all use newer versions of PS. Right now I have two ACTIONS that I apply if the image has a vertical or horizontal orientation, but I have to hand separate them.
I really would like to use a script to determine the shortest side, then crop off the long side to make a centered 75x75
I've attached what I've found on the internet... but it gives me errors because I think its built for cs2?
error it says is here: var sfwOptions = new ExportOptionsSaveForWeb();
Any help would be appreciated.
Lasa
oc = app.activeDocument;
var saveFile = new File(decodeURI(activeDocument.fullName.fsName).slice(0,-4) +"-thumb.jpg");
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
fitImageShortSide(75);
app.activeDocument.resizeCanvas(75, 75, AnchorPosition.TOPLEFT);
SaveForWeb(saveFile,60);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.preferences.rulerUnits = startRulerUnits;
function fitImageShortSide(newImgSize) {
if (doc.width > doc.height) {
doc.resizeImage(undefined, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width < doc.height) {
doc.resizeImage(newImgSize, undefined, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width == doc.height) {
doc.resizeImage(newImgSize, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
SaveForWeb(saveFile,60); //change to 100 for 100%
}
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
app.activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
I've been away for some time... good to be back.
I need to batch a good number of thumbnails for a website.
What I need are square 75x75 thumbnails make of various different image dimensions 640x480 and 480x640.
I found some PS scripts on the internet but they all use newer versions of PS. Right now I have two ACTIONS that I apply if the image has a vertical or horizontal orientation, but I have to hand separate them.
I really would like to use a script to determine the shortest side, then crop off the long side to make a centered 75x75
I've attached what I've found on the internet... but it gives me errors because I think its built for cs2?
error it says is here: var sfwOptions = new ExportOptionsSaveForWeb();
Any help would be appreciated.
Lasa
oc = app.activeDocument;
var saveFile = new File(decodeURI(activeDocument.fullName.fsName).slice(0,-4) +"-thumb.jpg");
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
fitImageShortSide(75);
app.activeDocument.resizeCanvas(75, 75, AnchorPosition.TOPLEFT);
SaveForWeb(saveFile,60);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.preferences.rulerUnits = startRulerUnits;
function fitImageShortSide(newImgSize) {
if (doc.width > doc.height) {
doc.resizeImage(undefined, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width < doc.height) {
doc.resizeImage(newImgSize, undefined, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width == doc.height) {
doc.resizeImage(newImgSize, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
SaveForWeb(saveFile,60); //change to 100 for 100%
}
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
app.activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}