Posts Tagged ‘merge layer’

[jsx] Merge layers on Photoshop utility

Thursday, October 20th, 2011

I made a utility of Photoshop.
It is written in jsx(javascript file).

It makes each layer merge.
That means it remove layer’s filters and mask.

When I import designer’s photoshop data into Flash or Mobile project,
the filters and mask are not necessary.

Copy below text and paste into new file named merge.jsx(whatever you like).
And in Photoshop app,
Select menu
File > Scripts > Browse…
and select the file.
You must have seen the files without filters and masks.

Here is the code.

var doc = app.activeDocument;
alert('merge complete');

function mergeLayers(layers){
    var len = layers.length;
    var parent = layers.parent;
    var newLayer;
    for(var i = 0; i < len; i++){
        var layer = layers[i];
        layer.allLocked = false;
        if(layer.typename == 'ArtLayer'){
            newLayer = parent.artLayers.add();
            newLayer.move(layer, ElementPlacement.PLACEAFTER);
        else if(layer.typename == 'LayerSet'){