tiff encoding and decoding