I read a 32bit bmp file. As result, I have a transparent image and RGB values is correct.
However, the source file contains an opaque image.
Maybe I am doing somthing wrong, but in case of a 24bit bmp image file the result is OK.
Looks like a bug.
I use IM 6.9.0 + Magick++.
Code: Select all
Magick::Image image;
try
{
image.read(utf8FileName);
image.colorSpace(Magick::sRGBColorspace);
image.type(Magick::TrueColorMatteType);
size_t height = image.rows();
size_t width = image.columns();
for (size_t i = 0; i < height; ++i)
{
const Magick::PixelPacket* pRow = image.getConstPixels(0, i, width, 1);
for (size_t j = 0; j < width; ++j)
{
std::cout<<static_cast<unsigned char>(pRow->opacity);//always 255 in case of a 32 bit bmp file, but 0 in case of a 24bit bmp file.
++pRow;
}
}
}
catch (const Magick::Exception& e)
{
std::cout<<e.what();
}