Skip to main content
April 10, 2010
Question

Flatten images

  • April 10, 2010
  • 1 reply
  • 823 views

How to check whether the TIFF image is flatten using javascript.

I hope we could check using the layer name as 'Background'.  Is there any other method apart from this?

regards,

Sashi

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
April 10, 2010

You could check the number of layers as well..


if(activeDocument.layers.length == 1 && activeDocument.activeLayer.isBackgroundLayer){
    alert("yup");
    }else{
        alert("nope");
}

Inspiring
April 10, 2010

You will want to use the test Paul suggested. Checking the layer name is not a good test. A layer can have the name 'Background' without the layer being the background layer.

Inspiring
April 11, 2010

Paul's test will miss cases where you have a tif file with a single layer and that layer is not a 'Background' layer.