JavaScript 适用于Adobe Photoshop CS2的图像缩放器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 适用于Adobe Photoshop CS2的图像缩放器相关的知识,希望对你有一定的参考价值。

/*
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);
	}
}

以上是关于JavaScript 适用于Adobe Photoshop CS2的图像缩放器的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 适用于Android的Adobe Air文件配置

Adobe Animate CC Javascript - 每次可见时启动动画

Adobe ANE 适用于 iOS 和 Android 设备,但不适用于 AIR 模拟器

JQ剪辑图片插件,适用于移动端和PC端

照片误删恢复软件Jihosoft Photo Recovery 2.0.1 Mac OS X

软件-设计-Adobe-Adobe XD:百科