How do I quickly export a layer as a png file in Photoshop with extendscript
I need to export every layer as png file, just like the context menu item(Quick Export as PNG) of layer does. Currently, I do this by:
... // Hide all layers
layer.visible = true; // Show the current layer only
doc.trim(TrimType.TRANSPARENT)
var options = new ExportOptionsSaveForWeb()
options.format = SaveDocumentType.PNG
options.PNG8 = false
var saveFile = new File(destFileName);
doc.exportDocument(saveFile, ExportType.SAVEFORWEB, options)
It does work, but it takes about 2 seconds for a layer in several PSD files. Why is it so slow? Is there a better approach to do this? like using runMenuItem()?
