read and write TIFF (.tif) files using libtiff