Expand description
Saving frames as PNG or TIFF at the camera’s bit depth.
Behind the image-io feature. A frame is first converted by
viva_pfnc::convert::full_depth: monochrome stays grey, everything else
becomes RGB, and samples wider than 8 bits — Mono10/12/14/16 packed or
not, and Bayer mosaics demosaiced at their own depth — are written as
16-bit images.
16-bit samples are scaled to the full 16-bit range, as PNG requires
of an encoder whose samples are narrower than the file’s (PNG 3rd edition
§12.4), by left bit replication: a 12-bit 0xABC is written 0xABCA.
value >> (16 − bits) gives the camera’s value back exactly. A PNG
records bits in its sBIT chunk (§11.3.2.4); TIFF has no such field,
so a TIFF holds the same scaled samples and the depth is yours to know.
Samples of 8 or 16 bits are written unchanged.
Files are uncompressed TIFF and default-compression PNG.
Enums§
- Image
Format - An image file format
encodewrites. - Image
IoError - Why an image could not be written.
Functions§
- encode
- A
width × heightimage as a file;Pixels::into_rgbfirst for colour. - encode_
frame - A frame as an image file, at its own depth (see the module documentation).
- save_
frame - Write a frame to
path, in the format its extension names.