No alpha when converting from rgba to palette

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
const

No alpha when converting from rgba to palette

Post 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?
Post Reply