【发布时间】:2021-04-09 12:18:54
【问题描述】:
我正在尝试在 Extendscript 中创建一个脚本来绘制一些东西,然后将整个画板导出为 4500x5400 像素(或任何其他特定大小)的 PNG。 这是我现在的代码:
//create new document with my desired size
var myDoc = app.documents.add();
myDoc.width = 4500;
myDoc.height = 5400;
//create a rectangle that is smaller than the artboard
var rect = myDoc.layers[0].pathItems.rectangle(700,300,72,100);
//export Image with name newImage.png (I have a specific path here)
exportFileToPNG24 ("~/newImage.png");
function exportFileToPNG24(dest) {
if (app.documents.length > 0) {
var exportOptions = new ExportOptionsPNG24();
exportOptions.artBoardClipping = true; //this option makes sure I export
//the whole artboard and not just
//the rectangle
var type = ExportType.PNG24;
var fileSpec = new File(dest);
app.activeDocument.exportFile(fileSpec, type, exportOptions);
}
}
脚本确实将整个画板导出为 png。但 PNG 的大小始终为 612x792 像素。如何让它以 4500x5400 像素导出?
【问题讨论】:
标签: export png adobe-illustrator extendscript