writeScanLine writes one row of data at a time to a file previously open for writing using the function TIFFWriteScanLine (see here). WriteStripedPage writes many lines at time (a "strip" of data) using the function TIFFWriteEncodedStrip (see here). The number of lines depends on the image width: the VI "libtiff2_CalcStrip.vi" takes care of calculating it by taking into account the bit per sample (8, 16, or 32) and trying to output strips that are around 8 kB each. Note that 8 kB is somewhat arbitrary, although "suggested" by libtiff. To experiment and change this value, you should change the constant named "Suggested strip size in bits (8 kB)" found in "libtiff2_CalcStrip.vi" from 65535 (default, corresponding to ~ 8 kB) to something else.
I got slightly faster execution times by using writeScanLine, but you should try which one performs better for your specific case, maybe playing around with the strip size. Note that both writeScanLine and writeStripedPage use "high level" functions, i.e. most probably it is possible to get the whole writing routine faster by calling other functions, such as TIFFWriteRawStrip. Maybe I will implement it in the next "release"! 😉
hope this helps and enjoy!
I am almost ready to upload several new VIs: now also RGB images will be supported (single or multipage), as well as some basic metadata writing/reading (plus several bug fixes!).
I was wondering what people out there might be interested in: special bit per pixel values (e. g. strange 12 or 14 bit images)? More than three colours (RGB+???)? Or what else?! I could try and include some of these features if there is enough interest!
let me know,
Thanks for your hard work! I'm working on an application which requires saving of 32bit TIFFs and came across your library. Do you think you can include a function to write in custom tags?
I'll try to create some VI to write/read custom tags: it would definitely add more flexibility to the whole thing.
Thanks for the suggestion!
no, I didn't try to write tiled TIFFs. However, before starting with libtiff I had no idea about how to write TIFF files at all!
I started with striped- or scanline-oriented files because I needed some VIs to write images from a scanning microscope, therefore these structures are closer to the original data format (sequential acquisition of pixels, line by line).
Anyway tiled TIFF are on my "to do" list, as soon as I will be less busy with my work!
No problem, I'll work with striped and scanline TIFFs first then. Its great that you have created this library, looking forward to your new edition soon. 🙂
as promised, here is the latest version of libtiff for labview!
Currently, the library supports writing/reading single or multipaged TIFF files in U8, U16, SGL, or RGB format. The files can be either scanline-oriented (i. e. a single line is written or read at a time) or striped (accessing a stripe made of multiple lines at a time). For RGB images, both separate color planes (i. e. first the plane containing the red values, then the gree and finally the blue) or contig color planes are allowed (i. e. for every pixel the red, green and blue one after the other).
- RGB support
- I eliminated small error that incorrectly displayed SGL values in the previous version.
- Metadata: the metadata entry is limited to few fields (ImageDescription, Software, Date, Time, and Artist).
- A VI named libtiff3_tif2Images converts TIFF files into an array of images.
Still to do:
-(your comment here!)
sorry for the delay.
I compiled a version of libtiff that *SHOULD* work on LV 8.5, but I didnt test it.
Let me know if there are any problems with it.