# Imagick::getImageChannelDepth

(PECL imagick 2.0.0)

Imagick::getImageChannelDepth特定の画像チャネルの深度を返す

### 説明

int Imagick::getImageChannelDepth ( int `\$channel` )

### パラメータ

`channel`

そのモードで有効なチャネル定数を指定します。 複数のチャネルを適用するには、チャネル定数 をビット演算子で組み合わせます。デフォルトは `Imagick::CHANNEL_DEFAULT` です。 チャネル定数 の一覧を参照ください。

### 返り値

``` For undocumented functions, this is a particular oddity.  For me, this function has so far returned only two values for any particular image: 1 and 8.  And, after experimenting with it about forty or fifty times, I think I understand how it works, based simply on my experience.The value returned is the number of bits used for the particular color channel within an image.  That means how variable a particular color is within an image.  While I received 1 and 8, it could theoretically be as much as 16 or 32, depending on how the technology evolves over, say, the next decade or so.To best understand this function, you should probably also understand the ImageMagick function getColorValue.  In terms of the ImageMagick class, a color can be measured between 0 and 1, in terms in of a particular pixel.  Red, Green, Blue, or, any particular color of any color scheme, can be something like 0.501960784314.  But, since each pixel is a combination of the three colors, you can have 0.845 for red, 0.254 for green, and 0.11 for blue.How does this all tie in with the getChannelDepth function?  Easy.  If all of the pixels in an image are either values 1 or values 0 for the particular Red/Green/Blue values, then this function will return a 1 for 1 bits per pixel for that color channel.  If, however, any single pixel in the image for the inputted channel parameter isn't exactly 1 or 0 for the particular color channel, then this function will return an 8 for 8-bit colors per pixel for that color channel.If you receive back a 1 for every single color channel put in the parameter, that means you're dealing with an image that's 16-bit -- you know, like those computer games published in 1982, or the Atari console games.  You won't ever forget a 16-bit color green, trust me.  If you get back an 8 for every single color channel put in the parameter, that means you're dealing with any standard, modern image.You can input any color channel, based on the channel constants available within the ImageMagick class.  See them here: http://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel .  That means a format like imagick::CHANNEL_UNDEFINED, but with the "_UNDEFINED" value being anything here: undefined, red, gray, cyan, green, magenta, blue, yellow, alpha, opacity, matte, black, index, all, and default.For any image with one pixel color of RGB value 1 / 0.501960784314 / 0.501960784314 (#FF8080), you get this result:Channel - 'Undefined' :        1Channel - 'Red' :     1Channel - 'Gray' :     1Channel - 'Cyan' :     1Channel - 'Green' :     8Channel - 'Magenta' :     8Channel - 'Blue' :     8Channel - 'Yellow' :     8Channel - 'Alpha' :     1Channel - 'Opacity' :     1Channel - 'Matte' :     1Channel - 'Black' :     1Channel - 'Index' :     1Channel - 'All' :     8Channel - 'Default' :     8If all colors are between 0 and 1 with getColorValue function, each of these results with be 1.  If you're dealing with an image that has full color spectrum depth (almost any given photograph), you'll get 8 for red, gray, cyan, green, magenta, blue, yellow, all, and default, with a 1 for the other remaining channels.  Perhaps some use for automated image editing, like use with posterize or oilpaint functions. ```