Roel Schroeven wrote:

> I can easily convert the bitmap to 24 bits, and then the image looks
> good in GIMP, which is to be expected since it doesn't contain any
> alpha information anymore. And it has the added benefit that the image
> files are smaller.
> Either way it's no big deal to me. I only wonder exactly where the
> alpha values come from,

They could come from anywhere.

Historically, neither the BMP format nor the internal Windows structures
that it maps to formally define an alpha channel.  The BITMAPINFOHEADER
biBitCount field can be set to 32, but the Windows SDK documentation
says that in that case "the high not used."  In the RGBQUAD
structure used to hold 32-bpp pixels, the fourth field is "rgbReserved,"
not "rgbAlpha," and the description is "Reserved; must be zero."

The rationale for 32-bpp BMPs with an unused byte per pixel was that it
kept pixels longword-aligned, which in long-ago times sped up image

Naturally, BMP has been extended so that alpha is sometimes stored in
that fourth byte, and sometimes this is done out of ignorance, because
people *assume* that a 32-bpp format supports alpha.  But alpha in BMP
is by no means widely supported.  There's no easy way to tell whether a
given 32-bpp BMP contains a real alpha channel.  And Windows itself
doesn't directly support BMP with alpha.

Since most 32-bpp BMPs *don't* contain alpha, and in those images the
fourth byte is 0, most image readers ignore the fourth byte.

A useful extension to any image loader/saver would be a preference
setting with options like

    * Assume 32-bpp BMPs have alpha
    * Assume that they don't
    * Ask me each time

- Ernie                        
Gimp-user mailing list

Reply via email to