我在Photoshop中有1個組,其中有多個圖像默認情況下隱藏,除了第一個圖像,我希望逐個顯示除第一個圖像之外的每個圖像然後用合併的第一層使用導出圖像在Photoshop中打開和關閉多個圖層腳本
注意導出爲圖片:請看到的截圖Layer
有人能指出我的方向是否有可能與腳本或採取任何行動?
我從來沒有在Photoshop中腳本,但試圖找出我自己的。
我在Photoshop中有1個組,其中有多個圖像默認情況下隱藏,除了第一個圖像,我希望逐個顯示除第一個圖像之外的每個圖像然後用合併的第一層使用導出圖像在Photoshop中打開和關閉多個圖層腳本
注意導出爲圖片:請看到的截圖Layer
有人能指出我的方向是否有可能與腳本或採取任何行動?
我從來沒有在Photoshop中腳本,但試圖找出我自己的。
編輯完整的文章,但此腳本涵蓋了原始腳本(僅適用於單層組)的可用性,並且也將其自身擴展到所有圖層組。
腳本從文件中的每個圖層組中取出圖層,並遍歷所有圖層,除了給定組中的第一個圖層打開和關閉以進行保存。對於給定的組迭代,每個組中的第一層始終可見。以PNG格式導出,但您可以調整所需的任何內容 - 導出選項,路徑,文件名等。爲CS6創建,但應該適用於任何版本,只需查看它。
您可能需要的更多信息在參考手冊中。只爲Google爲Photoshop CS6/CC Javascript參考。
下面的代碼,只需使用記事本複製粘貼,並保存爲jsx文件。您可以使用ExtendScript Toolkit進行測試(它已經與Adobe一起安裝,您只需要找到它)。如果它按預期工作,請將文件放置在Adobe \ Adobe Photoshop CS6(64位)\ Presets \ Scripts文件夾中,重新啓動Photoshop並通過文件>腳本菜單訪問該腳本。如果需要多次重複執行此操作,則還可以將鍵盤快捷鍵綁定到它。乾杯!
#target Photoshop
if (documents.length == 0) {
alert("nothing opened");
} else {
// start
//setup
var file = app.activeDocument;
var groupsAmount = file.layerSets.length; // get the layer groups
// iterate through groups
for (var k=0; k < groupsAmount; k++) {
hideAllLayers();
var images = file.layerSets[k].layers; // get the layers from the given group
file.layerSets[k].visible = true;
images[0].visible = true; // show the first layer in this group
// begin "i" from 1 to start from the 2nd layer
for (var i=1; i < images.length; i++) {
images[i].visible = true;
exportimage(images[i].name);
images[i].visible = false;
}
}
// function used to export image (adjust as you want accoring to the manual)
function exportimage(name){
var options = new ExportOptionsSaveForWeb();
options.format = SaveDocumentType.PNG;
options.PNG8 = false;
options.transparency = true;
options.optimized = true;
// adjust path & name
file.exportDocument(File(file.path+"/"+name+".png"),ExportType.SAVEFORWEB, options);
}
// function to hide all layers
// simplified version of http://morris-photographics.com/photoshop/scripts/downloads/Hide%20All%20Layers%202-1-0.jsx
function hideAllLayers() {
var ref = new ActionReference();
ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
var desc = new ActionDescriptor();
desc.putReference(cTID('null'), ref);
executeAction(sTID('selectAllLayers'), desc, DialogModes.NO);
var ref = new ActionReference();
ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
var list = new ActionList();
list.putReference(ref);
var desc = new ActionDescriptor();
desc.putList(cTID('null'), list);
executeAction(cTID('Hd '), desc, DialogModes.NO);
}
function cTID(s) {return app.charIDToTypeID(s);}
function sTID(s) {return app.stringIDToTypeID(s);}
//end
}
它是完美的工作!因爲我想但你能幫助我,如果在同一個文件中有多個文件夾,我想在單個文件夾上應用相同的東西? –
@LuicePhillips對答覆時間表示歉意,但沒時間。這是擴展版本 - 完全相同,但涵蓋所有組。請享用! –
感謝您的答覆,我已經嘗試更新的腳本,它的工作太棒了..再次感謝您的幫助 –