On Mon, Apr 15, 2002 at 11:45:41PM +0200, abel deuring wrote: > I would understand "gray:12" as meaning "gray scale data with 12 bit > values", but we allow only 1 and n*8 as depth. Or should "gray:12" mean > the real bit depth of the scanner's ADC?
It took me a moment to understand this too, but the intention here (which may need more supporting text) is to report the true dynamic range in bits, so as you said, a scanner with a 12-bit ADC would set this to "gray:12" even though it would be sending 16 bits per sample. Frontends can ignore this parameter and get excellent results, but if for some reason (e.g. file formats) they care about the real depth of the data they can discover it in this manner. e.g. an appropriate use for this information is to write it into the PNG significant bits structure 'sBIT' when saving a PNG. That reminds me, the SANE 2 specification needs a "note to developers" that mentions the need to copy high bits down when converting samples from a lower bit depth to a higher one e.g. 12 bit > 16 bit 0x000 0x0000 0x012 0x0120 0x5FE 0x5FE5 0xFED 0xFEDF 0xFFF 0xFFFF This was explained previously on the SANE list but we can't expect every backend author to go back and read the entire history of the list, so a mention in the documentation seems appropriate. Nick.