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

Modules

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

Structs

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

Enums

  • Resizing may run out of memory
  • Resizing type to use.

Functions

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

Type Aliases