-------------- resize_to_800.jsx -----------------
Code:
// the active document
var AD=activeDocument;
if (AD.width.value > AD.height.value) {
// process width
var currentAspectRatio = AD.width.value / AD.height.value;
alert (currentAspectRatio);
var newHeight = 800 / currentAspectRatio;
var newWidth = 800;
AD.resizeImage (newWidth, newHeight, 300, ResampleMethod.BILINEAR);
}
else {
// process height
var currentAspectRatio = AD.height.value / AD.width.value;
alert (currentAspectRatio);
var newHeight = 800;
var newWidth = 800 / currentAspectRatio;
AD.resizeImage (newWidth, newHeight, 300, ResampleMethod.BILINEAR);
} ----------------- save_as_jpg_9.jsx --------------------
Code:
// the active document
var AD=activeDocument;
// set to 8-bit depth for saving
var currentBitsPerChannel = AD.bitsPerChannel;
AD.bitsPerChannel = BitsPerChannelType.EIGHT ;
// If any documentes are open
if (app.documents.length >=1) {
// create a variable to get the current document name
myDoc = app.activeDocument.name;
}
else {
sampleDoc = "There are no documents open.";
}
// add the desired file name extension
var newFileName = myDoc.slice(0,-4) + "_c1_800"
alert (newFileName)
saveFile = new File(decodeURI(app.activeDocument.path)+'/'+newFileName+'.jpg')
saveOptions = new JPEGSaveOptions()
saveOptions.embedColorProfile = true
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE
saveOptions.matte = MatteType.NONE
saveOptions.quality = 9
AD.saveAs(saveFile, saveOptions, true, Extension.LOWERCASE)
AD.bitsPerChannel = currentBitsPerChannel; I put both of these files into C:/Program Files/Adobe/Adobe Photoshop CS4/Presets/Scripts