Fix big-endian tiff images.
merge with upstream
merge with upstream