annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

bmp issue with Read BMP File VI

Résolu !
Accéder à la 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 Compliments
Message 1 sur 13
3 813 Visites

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 Compliments
Message 2 sur 13
3 801 Visites

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

0 Compliments
Message 3 sur 13
3 797 Visites

@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 Compliments
Message 4 sur 13
3 750 Visites
Solution
Accepté par 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 sur 13
3 748 Visites

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 Compliments
Message 6 sur 13
3 744 Visites
Solution
Accepté par 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 Compliments
Message 7 sur 13
3 741 Visites

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 sur 13
3 709 Visites
Solution
Accepté par 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 Compliments
Message 9 sur 13
3 700 Visites

@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 Compliments
Message 10 sur 13
3 689 Visites