However, I ran into a problem whereby the saved image created this way has matte set and when viewed in PSP X the vast majority of the image is just the transparent background. OTOH, just to be awkward, Windows Picture and Fax Viewer ignores the matte setting and shows the full screen image.
If I change the program so that it writes a test.bmp file consisting of a BMP file header followed by the DIB (exactly as was given to MagickReadImageBlob) and then use "convert test.bmp testa.bmp" the output file is a normal BMP with no matte even though convert sees precisely the same info.
I used SetLogEventMask to create debugging output which shows that the DIB coder handles the image from MagickReadImageBlob whereas the BMP coder handles it when doing a convert and they obviously interpret the image in slightly different ways.
In the bmp.c coder the matte is set like this:
Code: Select all
image->matte=bmp_info.alpha_mask != 0 ? MagickTrue : MagickFalse;
The dib.c coder only handles 40 byte info headers - it throws an exception for any other size - and sets the matte like this:
Code: Select all
image->matte=dib_info.bits_per_pixel == 32 ? MagickTrue : MagickFalse;
In the meantime, in my program I have added a MagickSetImageMatte call after the MagickReadImageBlob to force the matte off.
Pete