/ Published in: JavaScript
Expand |
Embed | Plain Text
/* resizer.jsx for Adobe Photoshop CS2 WARNING: this script changes documents that will be processed. so be sure to duplicate documents before script runs. this script resizes images storing in given number of pixel. smaller images than given number won't be resized. all images will be changed into RGB color mode. last update: 2006-10-26 */ preferences.rulerUnits = Units.PIXELS; cutVal = 960; fileType = "*.psd"; folderObj = Folder.selectDialog("select folder"); if(folderObj != null) { inputFileType = prompt("input file type like '*.psd'", fileType); if(inputFileType != null) { fileType = inputFileType; } inputCutVal = prompt("input length (pixel)", cutVal); if(inputCutVal != null) { cutVal = eval(inputCutVal); } fileList = folderObj.getFiles(fileType); for(i = 0; i < fileList.length; i++) { open(fileList[i]); if(activeDocument.width.value > cutVal || activeDocument.height.value > cutVal) { if(activeDocument.width.value > activeDocument.height.value) { activeDocument.resizeImage( cutVal, (cutVal / activeDocument.width.value) * activeDocument.height.value, 72, ResampleMethod.BICUBICSHARPER ); } else { activeDocument.resizeImage( (cutVal / activeDocument.height.value) * activeDocument.width.value, cutVal, 72, ResampleMethod.BICUBICSHARPER ); } } activeDocument.changeMode(ChangeMode.RGB); activeDocument.close(SaveOptions.SAVECHANGES); } }
You need to login to post a comment.
