Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var doc = app.activeDocument;
doc.suspendHistory("Remove Normal Layers", "deletePixelLayers( doc )");
function deletePixelLayers(target)
{
try{
var layers = target.layers;
for (var i = 0; i < layers.length; i++)
{
var curLayer = layers[i];
// Layer is a group
if ("LayerSet" == curLayer.typename) {
deletePixelLayers(curLayer);
}
// Layer is a NORMAL (Pixel) Layers
if (LayerKind.NORMAL == curLayer.kind
&& !curLayer.isBackgroundLayer) {
curLayer.remove(); // Delete the layer
--i;
};
};
}catch(e){
; // do nothing
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.