Determine original image type (RGBA or only alpha)
Posted: 2010-05-20T03:56:28-07:00
Hi!
I have looked through the forum, but could not find an answer. I have troubles to tell an RGBA image apart from a black/white image.
If a PNG or TGA image is stored as RGBA, but the whole image is transparent, then ImageMagick always returns type BilevelType and color space RGBColorspace when reading the file. How can I tell that apart from a real bilevel image (indexed black/white with transparency)?
Image *image = new Image();
image->adjoin(true);
image->read(filename);
ImageType image_type = image->type(); // is BilevelType
ColorspaceType colorType = image->colorSpace(); // is RGBColorspace
If ImageMagick does some automatic quantization/color reduction, how can I turn that off for reading an image (for the sample code above).
Thanks.
I have looked through the forum, but could not find an answer. I have troubles to tell an RGBA image apart from a black/white image.
If a PNG or TGA image is stored as RGBA, but the whole image is transparent, then ImageMagick always returns type BilevelType and color space RGBColorspace when reading the file. How can I tell that apart from a real bilevel image (indexed black/white with transparency)?
Image *image = new Image();
image->adjoin(true);
image->read(filename);
ImageType image_type = image->type(); // is BilevelType
ColorspaceType colorType = image->colorSpace(); // is RGBColorspace
If ImageMagick does some automatic quantization/color reduction, how can I turn that off for reading an image (for the sample code above).
Thanks.