waz*_*day 5 photoshop extendscript
如何通过本地计算机上的位置抓取图像并将其插入到带有扩展脚本的图层中?
var doc = app.documents.add();
var layer = doc.artLayers.add();
var img = new File('~/Desktop/tanks.png');
layer.image = img; //I want to add the image to this layer
Run Code Online (Sandbox Code Playgroud)
我似乎所能做的就是打开图像作为背景,在此过程中创建一个新的 Photoshop 文档;
var opened = open(img);
Run Code Online (Sandbox Code Playgroud)
但我想实现的是将多个图像作为多个图层打开到同一个文档中。这可以做到吗?
使用找到的打开方法打开要合并的每个图像。然后循环浏览打开的文档并使用艺术图层对象上的复制方法将所有图层复制到单个目标文档。请参阅下面的代码片段,了解如何将单层图像复制到新文档。
//copy the layer into the target document
app.activeDocument = pSourceDocument;
pSourceDocument.artLayers[0].duplicate(pTargetDocument);
Run Code Online (Sandbox Code Playgroud)