Crate resize

Source
Expand description

Simple resampling library in pure Rust.

§Examples

use resize::Pixel::RGB8;
use resize::Type::Lanczos3;
use rgb::RGB8;
use rgb::FromSlice;

// Downscale by 2x.
let (w1, h1) = (640, 480);
let (w2, h2) = (320, 240);
// Don't forget to fill `src` with image data (RGB8).
let src = vec![0;w1*h1*3];
// Destination buffer. Must be mutable.
let mut dst = vec![0;w2*h2*3];
// Create reusable instance.
let mut resizer = resize::new(w1, h1, w2, h2, RGB8, Lanczos3)?;
// Do resize without heap allocations.
// Might be executed multiple times for different `src` or `dst`.
resizer.resize(src.as_rgb(), dst.as_rgb_mut());

Re-exports§

pub use px::PixelFormat;

Modules§

Pixel
Predefined constants for supported pixel formats.
px
Pixel format from the rgb crate.

Structs§

Filter
Resampling filter.
Resizer
Resampler with preallocated buffers and coeffecients for the given dimensions and filter type.

Enums§

Error
Resizing may run out of memory
Type
Resizing type to use.

Functions§

new
Create a new resizer instance. Alias for Resizer::new.
resizeDeprecated
Use new().resize() instead.

Type Aliases§

Result
See Error