Skip to main content

Module image_io

Module image_io 

Source
Expand description

Format-aware image opening.

Wraps image::open so:

  • HEIC/HEIF (every modern iPhone photo) decodes through libheif when the heic Cargo feature is enabled, fails clearly otherwise.
  • RAW (NEF / CR2 / ARW / DNG / ORF / RW2 / PEF / RWL / SRW via the TIFF walker; CR3 and RAF via their own containers) decodes via the camera’s embedded full-res JPEG preview when the raw feature is on (default).
  • Everything else falls through to the image crate.

Call this from any code path that previously did image::open(...) — thumbnail generation, face detection, brightness sampling.

Functions§

catch_decode
Run a decoder, turning a panic inside it into an ordinary error.
is_raw_extension
Recognises every TIFF-based RAW we route through the embedded-JPEG path. Kept in sync with scanner::SUPPORTED_EXTENSIONS and reindexer’s extension allowlist — adding a new RAW extension means touching this list too.
needs_display_rendition
Formats that need conversion before display in the system WebView.
open_image
Open and decode an image. Returns a fully-decoded DynamicImage regardless of the on-disk format. HEIC/HEIF route through libheif when compiled in; RAW files route through raw_preview to extract the embedded full-res JPEG preview (the camera’s intended rendering, much better than software-debayered output without proprietary colour profiles); everything else uses the image crate’s native decoders.
raw_preview_jpeg
Bytes of the embedded JPEG preview for any supported RAW: CR3 and RAF have their own containers, everything else is TIFF-based.