Expand description
Shared traits and types for zen* image codecs.
This crate defines the common API surface that all zen* codecs implement.
§Module organization
encode— encoder traits, dyn dispatch, output typesdecode— decoder traits, streaming/animation decode, dyn dispatch, output types- Root — shared types used by both encode and decode paths
§Shared types (root)
ImageFormat— format detection from magic bytesImageInfo/Metadata/Orientation/OrientationHint— image metadataResourceLimits/ThreadingPolicy— resource limit and threading configurationUnsupportedOperation/CodecErrorExt— standard unsupported operation reporting and error chain inspection
§Re-exported crates
The enough crate is re-exported for cooperative cancellation
(enough::Stop).
ⓘ
use enough::Stop;Individual codecs (zenjpeg, zenwebp, zengif, zenavif) implement the
encode and decode traits on their own config types.
Format-specific methods live on the concrete types, not on the traits.
zencodecs provides multi-format dispatch and convenience entry points.
Re-exports§
pub use exif::Exif;pub use exif::ExifPolicy;pub use exif::Retention;pub use exif::TextEncoding;pub use gainmap::GainMapChannel;pub use gainmap::GainMapDirection;pub use gainmap::GainMapInfo;pub use gainmap::GainMapParams;pub use gainmap::GainMapPresence;pub use gainmap::GainMapRender;pub use gainmap::ISO_21496_1_PRIMARY_APP2_BODY;pub use gainmap::ISO_21496_1_URN;pub use gainmap::Iso21496Format;pub use icc::icc_extract_cicp;Deprecated pub use enough;pub use whereat;
Modules§
- decode
- Decode traits, types, and configuration.
- encode
- Encode traits, types, and configuration.
- estimate
- Unified resource estimation for encode/decode operations.
- exif
- Structured EXIF/TIFF parsing, pruning, and serialization. Structured, borrowing EXIF/TIFF model: parse → inspect/prune → serialize.
- gainmap
- Cross-codec gain map types (ISO 21496-1). Cross-codec gain map types (ISO 21496-1).
- helpers
- Codec implementation helpers (not consumer API). Codec implementation helpers.
- icc
- Lightweight ICC profile inspection (tag extraction, no full parse). Lightweight ICC profile inspection.
Structs§
- Animation
Frame - A composited full-canvas animation frame, borrowing the decoder’s canvas.
- At
- An error with location tracking - wraps any error type.
- Cicp
- CICP color description (ITU-T H.273).
- Codec
Error - The error a zen codec returns: a coarse
ErrorCategoryfor routing, the name of the originating codec, and (optionally) the codec’s own detailed error. - Codec
IoKind - The kind of an I/O failure carried by
ErrorCategory::Io. - Color
Emit Fields - Mechanism fields behind
ColorEmitPolicy::Custom. - Color
Emit Plan - A resolved plan for emitting an image’s color description on encode.
- Content
Light Level - HDR content light level metadata (CEA-861.3 / CTA-861-H).
- Extensions
- A type-map storing multiple independently-typed extension values.
- Image
Format Definition - Describes an image format’s metadata, capabilities, and detection logic.
- Image
Format Registry - A collection of
ImageFormatDefinitions with lookup methods. - Image
Info - Image metadata obtained from probing or decoding.
- Mastering
Display - Mastering display color volume metadata (SMPTE ST 2086).
- Metadata
- Owned image metadata for encode/decode roundtrip.
- Metadata
Fields - Per-field metadata retention for
MetadataPolicy::Custom. - Owned
Animation Frame - A composited full-canvas animation frame with owned pixel data.
- Resolution
- Physical pixel resolution (DPI or pixels-per-unit).
- Resource
Limits - Resource limits for encode/decode operations.
- Source
Color - Source color description from the image file.
- Stop
Token - Owned, clonable, type-erased stop token.
- Stream
Offset - A byte offset into the encoded input, for attaching to an error’s location trace as retrievable context.
- Supplements
- Supplemental content that accompanies the primary image(s).
- Unstoppable
- A
Stopimplementation that never stops (no cooperative cancellation). - Unsupported
- Stub type for codecs that don’t support an operation.
Enums§
- Alloc
Preference - Caller preference for how a codec sizes buffers from untrusted input: the
fallible
try_reservepath (graceful out-of-memory error) or the faster infalliblevec!/Vec::with_capacitypath (aborts on OOM). - Cicp
Emission - Whether CICP is emitted, behind
ColorEmitPolicy::Custom. - Color
Authority - Which color metadata a CMS should prefer when building transforms.
- Color
Emit Policy - How an image’s color description (ICC profile vs CICP code points) is emitted when encoding or transcoding — the obvious, intent-named knob.
- Error
Category - Coarse, codec-agnostic classification of a codec error.
- IccDisposition
- What to do with the ICC profile channel for one encode.
- IccRetention
- How to treat the ICC profile when filtering
Metadata. - Image
Error - Image-bytes-origin failure kind — the payload of
ErrorCategory::Image. - Image
Format - Supported image formats.
- Image
Sequence - What kind of image sequence the file contains.
- Internal
Kind - Which kind of
ErrorCategory::Internalfailure — a coarse split for telemetry/triage, not a replacement for the downcast-recoverable detail error (CodecErrorExt::find_cause, theAttrace). - Invalid
Kind - Which caller-request “invalid” — the payload of
RequestError::Invalid. - Limit
Exceeded - A resource limit was exceeded.
- Limit
Kind - Which resource cap a
LimitExceededrefers to, without the actual/max values. Carried byResourceError::Limits(the payload ofErrorCategory::Resource) for routing; obtain it fromLimitExceeded::kind. - Metadata
Policy - Field-level metadata retention policy applied by
Metadata::filtered. - Orientation
- Image orientation — the 8-element D4 dihedral group.
- Orientation
Hint - How the decoder should handle orientation during decode.
- Policy
Kind - Which side of the encode/decode boundary a
ErrorCategory::Policyrejection applies to — mirrors the crate’s existingDecodePolicy/EncodePolicysplit, so a codec constructing the error already knows which one at the call site. - Request
Error - Caller-request-origin failure kind — the payload of
ErrorCategory::Request. - Resolution
Unit - Unit for
Resolutionvalues. - Resource
Error - Resource-origin failure kind — the payload of
ErrorCategory::Resource. - Threading
Policy - Threading policy for codec operations.
- Unsupported
Image Kind - Which image-bytes-origin “unsupported” — the payload of
ImageError::Unsupported. - Unsupported
Operation - Identifies an operation that a codec does not support.
Traits§
- Categorized
Error - Declares a codec error’s coarse
ErrorCategory. - Codec
Error Ext - Extension trait for inspecting codec errors.
- Error
AtExt - Extension trait that allows calling
.start_at()on error types. - Result
AtExt - Extension trait for adding location tracking to
Result<T, At<E>>. - Source
Encoding Details - Codec-agnostic interface for source encoding properties.
Functions§
- find_
cause - Walk an error’s
source()chain to find a cause of typeT. - resolve_
color_ emit - Reconcile a source’s color description against a target’s capabilities under
a
ColorEmitPolicy, returning what to emit.