PHP.mk документација

Imagick::getImageChannelDepth

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

imagick.getimagechanneldepth.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека imagick.getimagechanneldepth.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Imagick::getImageChannelDepth

Референца за `imagick.getimagechanneldepth.php` со подобрена типографија и навигација.

imagick.getimagechanneldepth.php

Imagick::getImageChannelDepth

(PECL imagick 2, PECL imagick 3)

Imagick::getImageChannelDepthGets the depth for a particular image channel

= NULL

public Imagick::getImageChannelDepth(int $channel): int

Ја добива длабочината за одреден канал на сликата

Параметри

channel

Ги добива опсезите за еден или повеќе канали на сликата. Овој метод е достапен ако Imagick е компајлиран со верзија на ImageMagick 6.4.0 или понова. Обезбедете каква било константа на каналот што е валидна за вашиот режим на канал. За да се примени на повеќе од еден канал, комбинирајте ги константите на типот на каналот користејќи бинарни оператори. Погледнете ја оваа листа на Обезбедете кој било константен канал што е валиден за вашиот режим на канали. За да се примени на повеќе од еден канал, комбинирајте Imagick::CHANNEL_DEFAULTсо бинарни оператори. Стандардно е Обезбедете каква било константа на каналот што е валидна за вашиот режим на канал. За да се примени на повеќе од еден канал, комбинирајте ги константите на типот на каналот користејќи бинарни оператори. Погледнете ја оваа листа на

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true на успешен исход.

Белешки од корисници 1 белешка

Keisial на gmail точка com
пред 13 години
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' :        1
Channel - 'Red' :     1
Channel - 'Gray' :     1
Channel - 'Cyan' :     1
Channel - 'Green' :     8
Channel - 'Magenta' :     8
Channel - 'Blue' :     8
Channel - 'Yellow' :     8
Channel - 'Alpha' :     1
Channel - 'Opacity' :     1
Channel - 'Matte' :     1
Channel - 'Black' :     1
Channel - 'Index' :     1
Channel - 'All' :     8
Channel - 'Default' :     8

If 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.
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.