Skip to main content

Crate zenpixels

Crate zenpixels 

Source
Expand description

Pixel format interchange types for Rust image codecs.

This crate provides the type system for describing pixel data: what the bytes are (PixelFormat), what they mean (PixelDescriptor), and where they live (PixelBuffer, PixelSlice, PixelSliceMut).

No conversion logic lives here. For transfer-function-aware conversion, gamut mapping, and codec format negotiation, see zenpixels-convert.

§Core types

  • PixelFormat — flat enum of byte layouts (Rgb8, Rgba16, OklabF32, etc.)
  • PixelDescriptor — format + transfer function + primaries + alpha mode + signal range
  • PixelBuffer — owned pixel storage with SIMD-aligned allocation
  • PixelSlice / PixelSliceMut — borrowed views with stride support
  • Pixel — trait mapping concrete types to their descriptor
  • Cicp — ITU-T H.273 color signaling codes
  • ColorContext — ICC profile bytes and/or CICP, Arc-shared
  • ConvertOptions — policies for lossy operations (alpha removal, depth reduction)

§Feature flags

FeatureWhat it enables
stdStandard library (default; currently a no-op, everything is no_std + alloc)
rgbPixel impls for rgb crate types, typed from_pixels() constructors
imgrefFrom<ImgRef> / From<ImgVec> conversions (implies rgb)
planarMulti-plane image types (YCbCr, Oklab, gain maps)

Re-exports§

pub use orientation::Orientation;
pub use descriptor::AlphaMode;
pub use descriptor::ByteOrder;
pub use descriptor::ChannelLayout;
pub use descriptor::ChannelType;
pub use descriptor::ColorModel;
pub use descriptor::ColorPrimaries;
pub use descriptor::PixelDescriptor;
pub use descriptor::PixelFormat;
pub use descriptor::SignalRange;
pub use descriptor::TransferFunction;
pub use buffer::Bgrx;
pub use buffer::BufferError;
pub use buffer::Pixel;
pub use buffer::PixelBuffer;
pub use buffer::PixelSlice;
pub use buffer::PixelSliceMut;
pub use buffer::Rgbx;
pub use cicp::Cicp;
pub use color::ColorContext;
pub use color::ColorOrigin;
pub use color::ColorProfileSource;
pub use color::ColorProvenance;
pub use color::NamedProfile;
pub use hdr::ContentLightLevel;
pub use hdr::MasteringDisplay;
pub use pixel_types::GrayAlpha8;
pub use pixel_types::GrayAlpha16;
pub use pixel_types::GrayAlphaF32;
pub use policy::AlphaPolicy;
pub use policy::ConvertOptions;
pub use policy::DepthPolicy;
pub use policy::GrayExpand;
pub use policy::LumaCoefficients;

Modules§

buffer
Opaque pixel buffer abstraction.
cicp
CICP (Coding-Independent Code Points) color description.
color
Color profile types for CMS integration.
descriptor
Pixel format descriptor types.
hdr
HDR metadata types.
orientation
EXIF orientation as an element of the D4 dihedral group.
pixel_types
Custom pixel types for gray+alpha formats.
policy
Conversion policy types for explicit control over lossy operations.

Macros§

at
Start tracing an error with crate metadata for repository links.

Structs§

At
An error with location tracking - wraps any error type.

Traits§

ResultAtExt
Extension trait for adding location tracking to Result<T, At<E>>.

Functions§

at
Wrap any value in At<E> and capture the caller’s location.