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.
- Linear
Gradient Mask - Linear gradient mask.
- Mask
Span - A contiguous horizontal span with uniform mask behavior.
- Mask
Spans - Inline collection of mask spans for one row.
- NoTransfer
- Identity transfer function: no conversion.
- Padding
- Padding to add around the resized output.
- Pixel
Descriptor - Compact pixel format descriptor.
- Pq
- SMPTE ST 2084 (PQ) transfer function for HDR10 content.
- Radial
Gradient Mask - Radial gradient mask.
- Resize
Config - Resize configuration built with
ResizeConfigBuilder. - Resize
Config Builder - Builder for
ResizeConfig. - Resizer
- Reusable resizer with pre-computed weight tables.
- Rounded
Rect Mask - Antialiased rounded rectangle mask.
- Source
Region - Region of the source image to use for resizing.
- Srgb
- sRGB transfer function.
- Streaming
Resize - Streaming resize state machine.
Enums§
- Alpha
Mode - Alpha channel interpretation.
- Blend
Mode - Porter-Duff and artistic blend modes.
- Channel
Layout - Channel layout (number and meaning of channels).
- Channel
Type - Channel storage type.
- Filter
- Named interpolation filter presets.
- Lobe
Ratio - Negative-lobe ratio control for resampling weights.
- Mask
Fill - Result of filling a mask row. Enables skipping work on uniform rows.
- Orient
Output - Post-resize orientation transform.
- Span
Kind - What kind of pixels a span contains.
- Streaming
Error - Errors from streaming resize push operations.
- Transfer
Function - Encoding transfer function (OETF).
- Working
Format - The internal working format of the streaming resizer.
Traits§
- Element
- Pixel element type.
- Mask
Source - Row-level mask generator.
- Result
AtExt - Extension trait for adding location tracking to
Result<T, At<E>>. - Transfer
Curve - 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 thergbcrate). - 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).