为每个图层创建蒙版,并将其保存下来Photoshop Scripting

时间:2018-10-13 07:55:17

标签: javascript photoshop photoshop-script

我想为每个图层添加图层蒙版,然后使用TIFF文件中的蒙版保存所有图层。谁能帮我?这是我的代码,它从所有层创建一个对象。

    var doc = app.activeDocument;
    var allLayers = new Array;
    var rv = new Object;
    var allLayers = collectAllLayers(doc, allLayers);
    var rv = toObject(allLayers, rv);
    function collectAllLayers (doc, allLayers){
        for (var m = 0; m < doc.layers.length; m++){
            var theLayer = doc.layers[m];

            if (theLayer.typename === "ArtLayer"){
                allLayers.push(theLayer.name);
            }else{
                collectAllLayers(theLayer, allLayers);
            }
        }
        return allLayers;
    }


    function toObject(allLayers, rv) {
      for (var i = 0; i < allLayers.length; ++i)
        if (allLayers[i] !== undefined) rv[i] = allLayers[i];
      return rv;
    }

alert(rv);

感谢提前答复!

0 个答案:

没有答案