When loading a 32 bit bitmap with "biCompression = BI_BITFIELDS", and when the bitmask of a channel (including the alpha channel) has more or less than 8 bits set, the resulting colors respectively alpha values are wrong.
To fix this, in module bmpfilt.pas, procedure BMPReadStream, the lines
rshift := IEGetFirstSetBit(BitFields[0]) - 1;
gshift := IEGetFirstSetBit(BitFields[1]) - 1;
bshift := IEGetFirstSetBit(BitFields[2]) - 1;
ashift := IEGetFirstSetBit(BitFields[3]) - 1;
must be supplemented to
rshift := IEGetFirstSetBit(BitFields[0]) - 1 + (_GetBitCount(BitFields[0]) - 8);
gshift := IEGetFirstSetBit(BitFields[1]) - 1 + (_GetBitCount(BitFields[1]) - 8);
bshift := IEGetFirstSetBit(BitFields[2]) - 1 + (_GetBitCount(BitFields[2]) - 8);
ashift := IEGetFirstSetBit(BitFields[3]) - 1 + (_GetBitCount(BitFields[3]) - 8);
in order to scale the resulting channel values to the range of [0..255].
Additional, a 32 bit bitmap with "biCompression = BI_BITFIELDS" and a header of type BITMAPINFOHEADER only has three DWORD bitmasks (red, green and blue) and no alpha mask, not four bitmasks (see https://docs.microsoft.com/de-de/previous-versions//dd183376%28v=vs.85%29 ). So the code loading the bitmasks should be
if xCompression = BI_BITFIELDS then
begin
case xBitCount of
...
32: begin
// red, green and blue masks
fs.Read(BitFields[0], sizeof(dword) * 3);
// no alpha mask
BitFields[3] := 0;
IgnoreAlpha := true;
end; // 32
end; // case
end; // if
and in line 1079
if BitFields[3] = 0 then
ashift := 0
else
ashift := IEGetFirstSetBit(BitFields[3]) - 1 + (_GetBitCount(BitFields[3]) - 8);