论坛帮助 |
社区圈子 |
日历事件 |
2022-11-14, 10:38 | 只看该作者 #8 | |||
|
||||
正式会员
等级: 四袋长老
|
引用:
options.verticalScale = 325; // 0.72*325 = 234 //234即为导出图片的分辨率 代码:
$.writeln("=================="); $.writeln("Begin... "); var folder = Folder.selectDialog(); var options = new ExportOptionsPNG24(); options.horizontalScale = 325; options.verticalScale = 325; options.antiAliasing = true; options.transparency = false; options.artBoardClipping = true; var document = app.activeDocument; var text_1 = document.name.split(".")[0]; if(document && folder) parseLayer(document, "", 1); function parseLayer(layer, base, depth) { var slides = []; var popups = []; var takeShots = true; log(depth, "parsing " + layer.name); for(var i=0; i<layer.layers.length; i++) { var l = layer.layers[i]; var name = l.name; var subLayer = true; if (name.indexOf("(+)")!=-1) { l.visible = true; subLayer = false; log(depth+1, name + " : always on"); } else if (name.indexOf("(-)")!=-1) { l.visible = false; subLayer = false; log(depth+1, name + " : always off"); } else if (name.indexOf("(~)")!=-1) { l.visible = false; subLayer = false; popups.push(l); } else { slides.push(l); } } log(depth, "slides = " + slides); // hide all popups for(var i = 0; i<popups.length; i++) popups[i].visible = false; for(var i = 0; i<slides.length; i++) { var l = slides[i]; // show current slide, hide all the others for(var j = 0; j<slides.length; j++) { slides[j].visible = i==j; log(depth, "setting " + slides[j].name + " visibility = " + (i==j)); } parseLayer(l, base+ (base=="" ? "" : "-") +l.name, depth+1); takeShots = false; } // hide all slides for(var i = 0; i<slides.length; i++) slides[i].visible = false; // capture popups for(var i=0; i<popups.length; i++) { var l = popups[i]; l.visible = true; var fname = text_1+ "-"+ base + "-" + l.name + ".png"; var file = new File(folder.fsName+"/"+fname); log(depth, " capture <"+fname + ">"); document.exportFile(file, ExportType.PNG24, options); l.visible = false; } if (takeShots) { var fname = text_1+ "-"+base + ".png"; var file = new File(folder.fsName+"/"+fname); log(depth, " capture <"+fname + ">"); document.exportFile(file, ExportType.PNG24, options); } } function log(depth, t) { for(var j=0; j<depth; j++) $.write("----"); $.writeln(t); } |
|||
右列会员因为此帖价值甚高向 baiju 表示感谢: |
Callmetait (2022-11-14)
|