TIFF and LibTiff Mail List Archive

# 2006.12.05 22:56 "[Tiff] Re: Tiff Digest, Vol 31, Issue 3", by Glenn Widener

> <>From: "Joris" <joris.at.lebbeke@skynet.be>
> Subject: [Tiff] Grayscale, or is it?\
>

> <>Anyone has any advice on this matter?
>
>
>
> >
>
Some, briefly.

I'm forever having trouble with grayscale in TIFF, except that now I really need to resolve it and make a final descision.

The TIFF spec, in "Section 4: Grayscale images" does not contain a good definition of grayscale. However, on page 73, "Comments for TIFF writers", in a discussion of gamma, it says "Be aware that the PhotometricInterpretation value of 0 or 1 (grayscale) implies linear data because no gamma is specified. The PhotometricInterpretation value of 2 (RGB data) specifies the NTSC gamma of 2.2 as a default."

We (SwiftView) used to obey the spec regarding a default gamma of 2.2. But we found no one else that does, so we can't either, and we changed the default to a straight linear device RGB. "No one else" includes at least.Microsoft Office Document Imaging and Paint Shop Pro 6.

Now, what is linear data? Linear to what? What is grayscale, for that matter?

Linear means literally read, write and send the values to your display unchanged - "linear device values". If you don't know what the correction is, or haven't been told, don't do any.

I see three possibilities.

1. Greyscale is R=G=B. I think this interpretation is consistent with most common practice. It is also consistent with the LibTiff RGBA interface implementation, in that this just sets R, G, and B, to the greyscale read from the TIFF. It is however a clear violation of the above quoted remark on gamma.

The standard conversion from RGB to gray, documented in the textbooks, is grey level = .33R+.5G+.17B. So a unitary conversion back to RGB is fine. Off the cuff, I would convert greyscale to RGB, apply whatever color correction you wish, then convert back. But then I'm not a color space expert. Converting gray levels 1:1 to the intensity component of a color space that has an intensity component makes perfect sense to me.