2017.05.11 17:35 "[Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by Yakov Galka

2017.05.22 13:13 "Re: [Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by John

On 22 May 2017 at 12:53, Yakov Galka <ybungalobill@gmail.com> wrote:

On Thu, May 11, 2017 at 11:48 PM, <jcupitt@gmail.com> wrote:

I don't think I've come across a reader which doesn't handle this case. Almost all jpeg-in-tiff files use this mode, so you really have to.

I take my words back. The only viewers that worked were mspaint and the windows photo viewer. IIPImage seems to have tried to support it but has a bug and fails. OpenCV imread fails. Pretty much every code that does not expect to handle this case *specifically* fails. Which I expect to be the majority of TIFF reading code in the wild.

I made a test image, hopefully this link will work:

https://drive.google.com/file/d/0B4ou5nOL1G-yODhjWDJZTDZFQ1k/view?usp=sharing

It's a tiled jpeg tiff, with YCbCr pixels and chroma subsampling. opencv 2.4.9 (the one I have here) is fine with it. I did notice an opencv bug on another image: if the tiff orientation tag is set, it fails to get the tile positions correct.

libreoffice seems to have trouble with even very simple tiff images. The imagej I have here does not support jpeg tiff. Everything else I have to test seems OK, including octave, eog, evince, abiword, pillow, gnumeric, matlab, windows picture viewer, gallery and paint, and irfanview.

I remember some problems with YCbCr in iipimage, but I think that was all resolved back in 2010. If it's broken, please open an issue and I'm sure Ruven would be very embarrassed and fix it very quickly.

It's arguably a basic misdesign with tiff: writers are simple (you can describe almost any pixel layout with a tiff header), but readers are hard (you have to be able to read almost any pixel layout),

I expect libTIFF to abstract those differences. It is not the only thing that libTIFF chooses to shift the responsibility onto the user of the library even though it could just as cheaply hide those pesky details. Another example would be the tile/strip discrepancy.

libtiff does have some higher-level read operations which hide this detail, TIFFReadRGBAImage() for example, but of course there can be downsides to having the details concealed.

John