unpack and repack Tiff image functions