Mass "Remove Masks" script?

What type of scripts do you need?

Moderator: byronnash

Post Reply
Posts: 68
Joined: February 16th, 2009, 12:41 pm

Since there isn't a keyboard shortcut for Remove Mask, anyone know of a script that can remove all Masks from selected layers?

I've inherited a messy comp with lots duplicated layers that have many unused masks.
Posts: 81
Joined: November 27th, 2012, 6:41 am

You can try this, it removes all masks blindly (save as .jsx in the ScriptUIPanel folder, restart AE, then launch from the Window menu):

Code: Select all

this.add("button{text: 'remove all masks'}").onClick = function(){
    var comp = app.project.activeItem;
    if (!comp || comp.typeName !== "Composition" || comp.selectedLayers.length<1){
        alert("No layer selected");
        var sel = comp.selectedLayers, N=sel.length, n, layer, numMasks;
        var removed = 0;
        app.beginUndoGroup("Remove All Masks");
        for (n=0; n<N; n++){
            layer = sel[n];
            if (!layer.mask) continue;
            numMasks = layer.mask.numProperties;
            removed += numMasks;
            while (numMasks>0) layer.mask(numMasks--).remove();
        alert("Removed " + removed + " masks on " + N + " layers");

Posts: 14
Joined: March 25th, 2011, 9:15 am

You can also use my much-neglected "Mask Selection Helper" script on It allows you to select all or some masks based on index or name matching. After selecting, you have to close the script window, then hit delete and the selected masks (even if they're not revealed) are deleted.
Post Reply