我想知道是否有可能在单个psd文件中执行可以执行以下操作的photshop动作:
有什么办法可以编码吗?我已经搜索了一段时间,甚至找不到任何与远程相关的东西。
非常感谢!
答案 0 :(得分:0)
仅在Internet上找不到您的特定需求所需的代码。
生活不是那么容易。
但是,有很多地方可以了解基本概念。这就是您所需要的。我建议您使用循环对其进行修改:
// call the source document
var srcDoc = app.activeDocument
// get layer "one"
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("one");
// set it's visibility to be true
app.activeDocument.activeLayer.visible = true;
// get layer "two"
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("two");
// set it to ve invisible
app.activeDocument.activeLayer.visible = false;
// set the name of the file here [CHANGE THIS]
var filePath = "c:\mypath\name_01.jpg";
// save as jpeg
save_as_jpeg(filePath);
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("one");
app.activeDocument.activeLayer.visible = false;
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("two");
app.activeDocument.activeLayer.visible = true;
// set the name of the file here [CHANGE THIS]
filePath = "c:\mypath\name_02.jpg";
// save as jpeg
save_as_jpeg(filePath);
function save_as_jpeg(filePath)
{
// Flatten the jpg
activeDocument.flatten();
// jpg file options
var jpgFile = new File(filePath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = myJpgQuality;
activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);
//close without saving
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
您正在寻找的是一种获取上面的代码并将其loop覆盖在上面的方法,这样它可以将第一层到第二层。