gpt4 book ai didi

adobe-illustrator - 如何在 Adob​​e Illustrator 中编写针对多种分辨率执行 "Save for web"的脚本?

转载 作者:行者123 更新时间:2023-12-04 07:49:23 24 4
gpt4 key购买 nike

每次我想将图像创建为不同的分辨率时,都必须单击“保存为网络”并更改分辨率,这很乏味。有没有办法编写一个脚本来自动实现这一点,将多个分辨率作为一个?

最佳答案

为此,我自己使用此功能

function saveDocumentAsPng(d, width, height) {
var fileName = d.fullName.toString();
if(fileName.lastIndexOf(".") >= 0) { fileName = fileName.substr(0, fileName.lastIndexOf("."));}
fileName += "_wxh.png".replace("w", width).replace("h", height);

var exportOptions = new ExportOptionsPNG24();
exportOptions.horizontalScale = exportOptions.verticalScale = 100 * Math.max(width/d.width, height/d.height);
var file = new File(fileName);

app.activeDocument = d;
d.exportFile(file, ExportType.PNG24, exportOptions);
}

请注意,它使用“_[width]x[height]”后缀命名结果png。

我根据 adobe 的 javascript 引用中的示例编写了我的函数 http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scripting/illustrator_scripting_reference_javascript_cs5.pdf (第 59 页)。

关于adobe-illustrator - 如何在 Adob​​e Illustrator 中编写针对多种分辨率执行 "Save for web"的脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18789668/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com