BigInch
Petroleum
- Jun 21, 2006
- 15,161
I am using this code to try to write a DIB to a 24 bit BMP file on disk. It almost works. The only problem I'm having is the colors are wrong. It seems to be reversing RGB values. Would someone kindly offer a correction?
Thanks!
BigInch
-born in the trenches.
Code:
' Open the output bitmap file.
fnum = FreeFile
Open fn For Binary As fnum
' Write the BITMAPFILEHEADER.
Put #fnum, , bitmap_file_header
' Write the BITMAPINFOHEADER.
' (Note that memBmp.bitmap_info.bmiHeader.biHeight
' must be positive for this.)
Put #fnum, , membmp.bitmap_info
' Get the DIB bits.
ReDim pixels(1 To 4, 1 To membmp.wid, 1 To membmp.hgt)
GetDIBits membmp.hdc, membmp.hBM, _
0, membmp.hgt, pixels(1, 1, 1), _
membmp.bitmap_info, DIB_RGB_COLORS
' Write the DIB bits.
Put #fnum, , pixels
' Close the file.
Close fnum
Thanks!
BigInch
![[worm] [worm] [worm]](/data/assets/smilies/worm.gif)