Layers - Maple Help

ImageTools

 Layers
 return the layer information of an image

 Calling Sequence Layers(img, info)

Parameters

 img - Image; input image info - (optional) type of information to return

Description

 • The Layers command returns the number of layers of an image. A grayscale image has one layer. A color image has three layers. A color image with alpha channel has four layers.
 • The img parameter is the image.

Information

 • The optional info parameter specifies the information to return. Its default value is size. The following operations are supported:
 – lower: lower layer index
 – upper: upper layer index
 – range: layer index range
 – size: number of layers

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img}≔\mathrm{Create}\left(100,200,\mathrm{channels}=3\right):$
 > $\mathrm{Layers}\left(\mathrm{img}\right)$
 ${3}$ (1)
 > $\mathrm{map2}\left(\mathrm{Layers},\mathrm{img},\left[\mathrm{size},\mathrm{lower},\mathrm{upper},\mathrm{range}\right]\right)$
 $\left[{3}{,}{1}{,}{3}{,}{1}{..}{3}\right]$ (2)
 > $\mathrm{img}≔\mathrm{Create}\left(100,200\right):$
 > $\mathrm{Layers}\left(\mathrm{img}\right)$
 ${1}$ (3)