Skip to main content

Crate zenresize

Crate zenresize 

Source
Expand description

High-quality image resampling with 31 filters, streaming API, and SIMD acceleration.

zenresize provides a standalone resize library extracted from the zenimage/imageflow image processing pipeline. It supports:

  • All 31 resampling filters from imageflow (Lanczos, Robidoux, Mitchell, etc.)
  • Row-at-a-time streaming API with V-first pipeline for pipeline integration
  • Built-in sRGB/linear conversion and alpha premultiply/unpremultiply
  • u8, i16, and f32 pixel format support
  • archmage-based SIMD (AVX2+FMA on x86, NEON on ARM)

§Quick Start

use zenresize::{Resizer, ResizeConfig, Filter, PixelDescriptor};

// Create a 4×4 RGBA test image
let input_pixels = vec![128u8; 4 * 4 * 4];

let config = ResizeConfig::builder(4, 4, 2, 2)
    .filter(Filter::Lanczos)
    .format(PixelDescriptor::RGBA8_SRGB)
    .build();

let output = Resizer::new(&config).resize(&input_pixels);
assert_eq!(output.len(), 2 * 2 * 4);

Re-exports§

pub use plane::PlaneResizer;
pub use composite::Background;
pub use composite::CompositeError;
pub use composite::NoBackground;
pub use composite::SliceBackground;
pub use composite::SolidBackground;
pub use composite::StreamedBackground;
pub use composite::composite_over_premul;
pub use composite::composite_over_solid_opaque_premul;
pub use composite::composite_over_solid_premul;
pub use composite::unpremultiply_f32_row;

Modules§

composite
Compositing for blending resized images onto backgrounds.
plane
Single-plane i16 image resizer.

Structs§

At
An error with location tracking - wraps any error type.
Bt709
BT.709 transfer function (also used for BT.601).
Hlg
HLG (Hybrid Log-Gamma) transfer function for broadcast HDR.
LinearGradientMask
Linear gradient mask.
MaskSpan
A contiguous horizontal span with uniform mask behavior.
MaskSpans
Inline collection of mask spans for one row.
NoTransfer
Identity transfer function: no conversion.
Padding
Padding to add around the resized output.
PixelDescriptor
Compact pixel format descriptor.
Pq
SMPTE ST 2084 (PQ) transfer function for HDR10 content.
RadialGradientMask
Radial gradient mask.
ResizeConfig
Resize configuration built with ResizeConfigBuilder.
ResizeConfigBuilder
Builder for ResizeConfig.
Resizer
Reusable resizer with pre-computed weight tables.
RoundedRectMask
Antialiased rounded rectangle mask.
SourceRegion
Region of the source image to use for resizing.
Srgb
sRGB transfer function.
StreamingResize
Streaming resize state machine.

Enums§

AlphaMode
Alpha channel interpretation.
BlendMode
Porter-Duff and artistic blend modes.
ChannelLayout
Channel layout (number and meaning of channels).
ChannelType
Channel storage type.
Filter
Named interpolation filter presets.
LobeRatio
Negative-lobe ratio control for resampling weights.
MaskFill
Result of filling a mask row. Enables skipping work on uniform rows.
OrientOutput
Post-resize orientation transform.
SpanKind
What kind of pixels a span contains.
StreamingError
Errors from streaming resize push operations.
TransferFunction
Encoding transfer function (OETF).
WorkingFormat
The internal working format of the streaming resizer.

Traits§

Element
Pixel element type.
MaskSource
Row-level mask generator.
ResultAtExt
Extension trait for adding location tracking to Result<T, At<E>>.
TransferCurve
Transfer function for encoding/decoding pixel values to/from linear light.

Functions§

mask_pixel_align
Preferred pixel alignment for mask span boundaries on the current platform.
resize_3ch
Resize a 3-channel u8 image. Works with rgb::RGB<u8>, rgb::BGR<u8>, etc.
resize_4ch
Resize a 4-channel u8 image. Works with any pixel type that implements ComponentSlice (RGBA, BGRA, ARGB, ABGR from the rgb crate).
resize_gray8
Resize a grayscale u8 image.
resize_hfirst_streaming
H-first streaming resize for sRGB u8 4ch.
resize_hfirst_streaming_f32
H-first streaming resize for the f32 path (any channel count).