Skip to main content

Module format

Module format 

Source
Expand description

Which formats this build can decode.

Asked of image rather than kept as a list here, because the answer is decided by cargo features in the workspace root and a second list would be a second opinion — right until someone switched a feature on and forgot this file.

What it is for: a viewer needs to know whether a file is worth opening before it opens it (for the filmstrip, which meets a folder of mixed things), and the .desktop file must claim exactly the MIME types the binary can actually open. A .desktop that claims image/webp while the decoder is absent is a file association that opens a window and shows an error.

§The trap in reading_enabled

image’s own ImageFormat::reading_enabled() answers cfg!(feature = "avif") for AVIF — but that feature is the encoder (ravif). Decoding AVIF needs avif-native and the system libdav1d. So if anyone ever enables avif to write one, this module would start claiming AVIF is readable and the viewer would advertise a MIME type it cannot open. decodable_formats filters that case out by hand, and tests::avif_is_never_reported_as_decodable fails if the situation changes.

Functions§

decodable_formats
Every format this build can actually decode.
decodable_mime_types
Every MIME type this build can decode, sorted, for the .desktop file’s MimeType= line and for matching against a shared-MIME lookup.
looks_decodable
Whether this path looks like a picture this build can open.