LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bmp issue with Read BMP File VI

Solved!
Go to solution

Hi Guys,

 

I have a weird issue with a bmp file that I'm trying to use Read BMP File VI on. It's generated from a camera. With the bmp file as is from the camera, I get "Read from Binary File in Read BMP File Data.vi" with error code 1. If I open the bmp file with infranview and save it as a bmp file, I get no error in Read BMP File Data.vi.

 

Anyone happen to know the solution? It seems that I'm not the first (example) to run into something odd.


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 1 of 13
(3,360 Views)

There are so many different bmp formats that I'm not surprised that that particular one is not supported.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 13
(3,348 Views)

It would be helpful to post an example image that doesn't work and the converted one that does.

0 Kudos
Message 3 of 13
(3,344 Views)

@BertMcMahan wrote:

It would be helpful to post an example image that doesn't work and the converted one that does.


Yeah, I wish I could. Most of the images are proprietary, so I would have to take special image of something random to do this. I can probably do that if needed, but I did just discover that the "issue bmp" image has 32 bit depth while the "infranview bmp" has 24 bit depth.

 

Does that difference in bit depth explain the error in Read BMP File Data.vi?


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 4 of 13
(3,297 Views)
Solution
Accepted by topic author WavePacket

@WavePacket wrote:

@BertMcMahan wrote:

It would be helpful to post an example image that doesn't work and the converted one that does.


Yeah, I wish I could. Most of the images are proprietary, so I would have to take special image of something random to do this. I can probably do that if needed, but I did just discover that the "issue bmp" image has 32 bit depth while the "infranview bmp" has 24 bit depth.

 

Does that difference in bit depth explain the error in Read BMP File Data.vi?


This is what I expected.  LabVIEW does not support 32 bit bmp files.  (I don't know if it supports any 32-bit image formats.)  See here.

The detailed help for a function is very helpful - and detailed, of course.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 13
(3,295 Views)

Yeah, Ok. So I guess my need now is to convert the bit depth programmatically somehow. Is that possible?  


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 6 of 13
(3,291 Views)
Solution
Accepted by topic author WavePacket

@WavePacket wrote:

Yeah, Ok. So I guess my need now is to convert the bit depth programmatically somehow. Is that possible?  


Sure. Irfanview and other image conversion programs also support a command line interface. Easy to call with System Exec in LabVIEW.

 

Or you can hack into the LabVIEW VIs and add support for 32 bit BMP images if you really want to know how these things work. But beware, image format handling is a very tedious and nasty low level business and requires some specific abilities that are not commonly used in other LabVIEW programming (nor most any other programming).

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 13
(3,288 Views)

In-case this helps someone else, here is the code snippet of what worked for me.

Conversion.PNG


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
Message 8 of 13
(3,256 Views)
Solution
Accepted by topic author WavePacket

Also you can probably load the image in a .Net Picturebox.  Here is some code I posted for displaying an image and having it scale without needing custom code.

 

https://forums.ni.com/t5/LabVIEW/Read-multi-image-tiff/m-p/3580103#M1002365

 

I don't have a 32-bit BMP to test with, but it handles other alpha layer transparencies in PNG files just fine.

0 Kudos
Message 9 of 13
(3,247 Views)

@Hooovahh wrote:

Also you can probably load the image in a .Net Picturebox.  Here is some code I posted for displaying an image and having it scale without needing custom code.

 

https://forums.ni.com/t5/LabVIEW/Read-multi-image-tiff/m-p/3580103#M1002365

 

I don't have a 32-bit BMP to test with, but it handles other alpha layer transparencies in PNG files just fine.


I just downloaded the image zip but when loading "Demo Load Image.vi" it said that it was missing "Current VIs Parent Directory_ogtk.vi". Any thoughts?


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 10 of 13
(3,236 Views)