Distinguish multi-layer from multi-image
Posted: 2007-04-04T17:17:51-07:00
What is the best way to distinguish a multi-layer image from an image file containing multiple pages? I used to convert all files with an index of [0] to grab just the first image of multi-page files, for example, to get just the high-res image if the input is a TIFF with a low-res image at index [1]. However, if the input is a multi-layer PSD, specifying an index of [0] means that I miss all the other layers, so I started using -flatten instead. But now, a TIFF with a low-res thumb is (understandably) pixellated when I use -flatten instead of index [0].
Ultimately, I want to use -flatten whenever the input file is multi-layer, but an index of [0] if the input file is multi-page. How can I reliably distinguish the two types, since a TIFF, for example, can be either multi-layer or multi-page?
Ultimately, I want to use -flatten whenever the input file is multi-layer, but an index of [0] if the input file is multi-page. How can I reliably distinguish the two types, since a TIFF, for example, can be either multi-layer or multi-page?