diff --git a/crates/texture/README.md b/crates/texture/README.md index f860fc9cd4..e52aedc17a 100644 --- a/crates/texture/README.md +++ b/crates/texture/README.md @@ -62,7 +62,8 @@ network I/O and has no `unsafe` code. `decode::hdr` and `decode::exr` turn a file's bytes into a plane. Integer samples are divided by their maximum (255 or 65535), so a 16-bit file keeps all 65536 levels. Float samples are kept as stored, values above 1 and negative values included, and OpenEXR NaN and infinities - too. Gray without alpha gives a gray plane, as does an OpenEXR file of exactly one channel + too, except that 64-bit TIFF floats are narrowed to 32 bits and lose any precision beyond + `f32`. Gray without alpha gives a gray plane, as does an OpenEXR file of exactly one channel whatever its name; every other layout gives RGBA, with alpha 1 when the file has none. The result's `transfer` is `Encoded` for integer code values whose transfer the file does not state, `Linear` for Radiance HDR, OpenEXR and PNG with a linear `cICP`, and diff --git a/crates/texture/src/decode.rs b/crates/texture/src/decode.rs index 0c0e642628..c9faaac858 100644 --- a/crates/texture/src/decode.rs +++ b/crates/texture/src/decode.rs @@ -1,7 +1,8 @@ //! Decoding PNG, TIFF, Radiance HDR and OpenEXR bytes into float [`Image`] planes, each format //! behind its own Cargo feature. Integer samples are scaled by their own maximum (255 for 8 bits, //! 65535 for 16 bits), so a 16-bit file keeps all 65536 levels. Float samples are kept as stored: -//! values above 1, negative values and, in OpenEXR, NaN and infinities. +//! values above 1, negative values and, in OpenEXR, NaN and infinities. The one exception is a +//! 64-bit TIFF float, which is narrowed to `f32` and loses any precision beyond it. //! //! Every function takes the file's bytes and does no I/O. The size of the result is checked //! against [`Limits`] before its plane is reserved, and the reservation is fallible. The format