It looks like you values are shifted, probably because you're missing a byte.
You should check that the BMP
file is actually a 24bit RGB
bitmap, and not something like 32bit RGBA
.
Try putting a bit count of 32
instead of 24
, there may be an unused byte in the your BMP
pixels :
bmpInfo.bmiHeader.biBitCount = 32;