LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying a bitmap in memory

I have acquired an image from a frame grabber in memory in Windows DIB format. I have added the BMP headers so that I can save the file.

I then use the NewBitmap() function to create a bitmapID. The char *image parameter expects the format of the data to be 0xRRGGBB but the bitmap format is 0xBBGGRR so when I display the bitmap to my canvas control the reds and blues are transposed.

After I modified the app to read the same image, that was saved to a BMP file, using GetBitmapFromFile() the image was displayed correctly in the canvas control.

This same function has been built into a DLL that is subsequently used by a LabVIEW application and the image is displayed correctly without having to read from a BMP file.

I used CanvasDrawBitm
ap() to display the bitmap file in the canvas.

Is there a way to have NewBitmap() use the format 0xBBGGRR. Or is there another way to display the BMP file in memory?


NI Software : LabWindows/CVI version 6.0
NI Hardware : None
OS : Windows XP

Thanks

Randy Schmidt
0 Kudos
Message 1 of 3
(2,974 Views)
Hello

The color format used in the NewBitmap() function is pretty much fixed(0xRRGGBB as mentioned in the help), so unless you can byte swap the frame grabber data, I dont think you will be able to use the NewBitmap() directly.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(2,974 Views)
I need to turn a DIB, of which I only have the handle number, into an IMAQ image, or at least into a U32 array, as to convert it into an image. Do you know how can I do that? The DIB comes from an activeX control which controls IEEE1394 camera.

Thanks

Felipe Llach
0 Kudos
Message 3 of 3
(2,974 Views)