LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read .tiff pictures?

we've know that there are read .jepg .bmp and .png VIs in the graphic and voices module, but how can we read .tiff the same way as other formats.

~6HE(Z9KY1JWPOSCRM6~%S2.png

0 Kudos
Message 1 of 6
(984 Views)

I think the vision module can read tiffs. Do you have it?

 

Of course, in the end, a tiff file is just bytes and it would be relatively easy to write your own in plain LabVIEW, supporting a subset of options and formats. Study the documentation.

 

 

0 Kudos
Message 2 of 6
(976 Views)

One reason why there is no TIFF function in the palettes is the fact that TIFF is a VERY loosely defined format. TIFF itself only defines the tag structure and some basic tags that can be used to store things like image resolution, image size, bit depth, color model and then the tags for the color planes. But it allows to store absolutely anything in a file and invent your own tags, compression schemes, formatting and things.

 

As such it is pretty much impossible to write a TIFF library that can read most files with a TIFF tag on them. There are a few common formats that are often used, but the average user will not understand why his TIFF file can't be read by a library claiming to support TIFF, just as much as they will not understand why the TIFF Write might create a format that his very beloved image view application can't read.

 

Rather than creating something that causes lots of technical support questions, it is sometimes easier to simply not provide that functionality at all.

 

As Altenbach explained, it can be done yourself (if you know what flavor and variant of TIFF you want to deal with) and there are even various user provided VIs floating around that have tried to do it. Almost all of them do whatever format the specific user had to deal with at that point and might very likely not work for your specific case.

 

Alternatively there is also somewhere a project that tried to interface to libtiff, a shared library programmed in C. This library is fairly good and also provides support to deal with custom datatypes, but this is pretty hard to interface in LabVIEW with, as LabVIEW is a very strictly typed programming language, and API flexibility is usually based on untyped parameters that can adapt to whatever the C programmer "knows" the variable to have to be. LabVIEW doesn't allow that (among other things since many LabVIEW users are not programmers and do not "know" what datatype a value has to be) so if you want to support different datatypes you have to either use variants and convert them all explicitly to the real datatype before passing it to the C function, or program one VI for every function for every datatype.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(930 Views)

Thank you for your suggestion, sir.  I have already downloaded the Vision Module and used the image2array.vi to get my target.  Thanks again.

0 Kudos
Message 4 of 6
(906 Views)

THANKS!

 

Thank you for your time and patience in explaining why there is no read-tiff .vi in the Graphic and Voices. Your answer is so detailed that I learn some logic behind the LabVIEW, which the freshman benefits greatly. thanks again.

 

 

0 Kudos
Message 5 of 6
(900 Views)

@altenbach wrote:

Of course, in the end, a tiff file is just bytes and it would be relatively easy to write your own in plain LabVIEW, supporting a subset of options and formats. Study the documentation.


Instead of parsing tiff yourself or using libtiff, it's a lot easier to use .NET Framework.  See attached VIs.

 

George Zou
Download All
0 Kudos
Message 6 of 6
(844 Views)