Expand description
Pictures macOS decodes through ImageIO: AVIF, HEIC and HEIF, JPEG XL
(macOS 14 and later) and their animated forms (AVIF and HEIF
sequences). The image crate reads none of them, so on macOS these
decode here at full resolution, turned by their orientation, and
animated files hand out their frames and delays. Elsewhere every call
fails and callers fall back to QuickLook or a placeholder.
Which formats the running system reads is asked of ImageIO
(CGImageSourceCopyTypeIdentifiers), so JPEG XL on macOS 13 reports
itself unsupported instead of failing every decode.
Structs§
- Animation
- An animated AVIF or HEIF sequence, read frame by frame. Each frame is a whole picture (sequence frames don’t need compositing).
- Write
Frame - One picture to write with [
write].
Functions§
- available
- Whether the running system’s ImageIO reads
ext(JPEG XL needs macOS 14). Always false off macOS. - decode
- Decodes the file’s main picture at full resolution, turned upright.
- decode_
bytes_ within - Decodes the picture in
datano larger thanmax_sidepixels on its longer side, as straight-alpha sRGB RGBA, not turned. ImageIO scales while it decodes (a JPEG at a fraction of its size directly), so a huge picture never sits in memory at full size. Any format ImageIO reads. - delay_
ms - A frame’s delay in milliseconds from its ImageIO properties: the unclamped delay when the file gives one, else the clamped one, in seconds. Browsers’ rule for tiny delays is applied by the player.
- handles
- Whether
extis one of the formats this module decodes on a system that supports it (seeavailablefor whether this one does). - is_
animated - Whether a file of
countimages is an animation: several images, the first carrying a frame delay. An image collection (a HEIF burst, or a HEIC with its depth map) has several images but no timing, and stays a still. - orientation
- The orientation an ImageIO
Orientationproperty (the EXIF values 1–8) stands for; anything else leaves the picture as stored. - oriented_
size - The size a picture of
wxhstored pixels shows at once turned. - type_of
- The ImageIO type of a (lower-case) extension this module handles.
- write
- Writes
framestopathas the ImageIO format ofext(macOS can write AVIF, HEIC and HEIF sequences, not AVIF sequences or JPEG XL). Several frames with delays make a HEIF sequence.