LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write bmp to binary file issues

Solved!
Go to solution

Hi,

 

I have a BMP text string I have obtained from a Yokogawa oscilloscope. I can write this file directly to a .BMP but the binary write appends 4 bytes to the beginning of the BMP string that makes it an invalid BMP format. Removing those 4 bytes with a text editor, saving, and reopening the file will make it valid which can be opened by any image viewer.

 

I have also tried the regular write text to file function but it makes the image jarbled, however, does not append the extra 4 bytes as binary write does.

 

And I have tried the recommendation from this post but the BMP file is also jarbled.

http://forums.ni.com/t5/LabVIEW/problems-creating-a-BMP-file/m-p/757714/highlight/true#M347071

 

Here is my VI:

 

bd2.JPG

Writing file with binary write, extra 4 bytes...

 

bytes.JPG

 

I don't see the 4 bytes here in the data string!

 

bytes2.JPG

 

 

0 Kudos
Message 1 of 6
(3,476 Views)
Solution
Accepted by topic author abeaver

What happens if you wire a FALSE to the "prepend array or string size" when writing the binary file? (defaults is TRUE!)

 

(If you use "write to text file" make sure that "convert EOL" is disabled (It is enabled by default).)

Message 2 of 6
(3,474 Views)

Thanks for the quick reply! That's what I get for not reading the help files. Here is my final block diagram:

bd3.JPG

0 Kudos
Message 3 of 6
(3,457 Views)

@altenbach wrote:

What happens if you wire a FALSE to the "prepend array or string size" when writing the binary file? (defaults is TRUE!)


Can't tell you how many times I have been bit by that one.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,420 Views)

@crossrulz wrote:

@altenbach wrote:

What happens if you wire a FALSE to the "prepend array or string size" when writing the binary file? (defaults is TRUE!)


Can't tell you how many times I have been bit by that one.


You should think that banging your head against a wall once should be enough to learn! Smiley Very Happy

 

The default is a quite useful feature if you write more complicated binary data files, which the write to binary data was meant to be used for originally.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 6
(3,404 Views)

please to attach VI file

0 Kudos
Message 6 of 6
(3,079 Views)