png_get_channels

Name

png_get_channels -- get number of color channels in image

Synopsis

#include <png.h>

png_byte png_get_channels(png_structp png_ptr, png_infop info_ptr);

Description

png_get_channels() shall return the number of data channels per pixel for the color type of the image. The number of channels shall range from 1-4 depending on the color type as given below.

1 - PNG_COLOR_TYPE_GRAY or PNG_COLOR_TYPE_PALETTE
2 - PNG_COLOR_TYPE_GRAY_ALPHA
3 - PNG_COLOR_TYPE_RGB
4 - PNG_COLOR_TYPE_RGB_ALPHA or PNG_COLOR_TYPE_RGB+filler byte

Return Value

On success, png_get_channels() shall return the number of channels ranging from 1-4. Otherwise, png_get_channels shall return 0.