我怎样才能 "Merge Visible" 到 Photoshop 脚本中的图层?
How can I "Merge Visible" to a layer in a Photoshop script?
activeDocument.mergeVisibleLayers();
命令只是将图像拼合到背景层。
我正在寻找一种方法将所有层合并到一个位于所有其他层之上的新层,例如 Layer->Merge Visible (Ctrl+Shift+E) Photoshop 命令。
这可能吗?
不确定这是否是最佳解决方案,但它对我有用:
// Copy all visible layers to clipboard (true = merged)
activeDocument.activeLayer.copy(true);
// then paste them (creates a new layer)
activeDocument.paste();
does not work well with tranparent images (it crops the transparency and aligns the pasted image to the middle). Here is a script that simply executes the Merge Visible command, found with the Scripting Listener plug-in:
var idMrgV = charIDToTypeID("MrgV");
executeAction(idMrgV, undefined, DialogModes.NO);
activeDocument.mergeVisibleLayers();
命令只是将图像拼合到背景层。
我正在寻找一种方法将所有层合并到一个位于所有其他层之上的新层,例如 Layer->Merge Visible (Ctrl+Shift+E) Photoshop 命令。
这可能吗?
不确定这是否是最佳解决方案,但它对我有用:
// Copy all visible layers to clipboard (true = merged)
activeDocument.activeLayer.copy(true);
// then paste them (creates a new layer)
activeDocument.paste();
var idMrgV = charIDToTypeID("MrgV");
executeAction(idMrgV, undefined, DialogModes.NO);