Page 1 of 1

No alpha when converting from rgba to palette

Posted: 2007-10-30T09:15:19-07:00
by const
Hello, I'm trying to convert my in-memory image stored as sequence of RGBA pixels to indexed one, but alpha channel information disappears from colormap.

Code: Select all

//QuantumSize equals 8
//images - is a pointer to memory where data stored
Magick::Image img(64, 64, "RGBA", Magick::CharPixel, images);
// converting to 8-bits indexed
img.type(Magick::PaletteMatteType);

Now storing to file palette information:
int count = img.colorMapSize();
const MagickLib::Image* imgptr = img.constImage();
fwrite(imgptr->colormap, sizeof(unsigned int), count, pf);
Checking written file tells us, that all alpha-channel bytes are equal to zero.
Could someone clarify how to solve this issue?