Simple resampling library in pure Rust.
Features: * No dependencies, minimal abstractions * No encoders/decoders, meant to be used with some external library * Tuned for resizing to the same dimensions multiple times: uses preallocated buffers and matrixes * Tuned to have result as close as possible to ImageMagick
rust
extern crate resize;
use resize::Type::Triangle;
let mut src = vec![0;w1*h1];
let mut dst = vec![0;w2*h2];
let mut resizer = resize::new(w1, h1, w2, h2, Triangle);
resizer.run(&src, &mut dst);
See API documentation for overview of all available methods. See also this example. Comparision with IM for the same filter:
bash
cd examples
../target/debug/examples/resize tiger.png 540x360 rust.png
convert tiger.png -filter Triangle -resize 540x360 im.png
compare rust.png im.png -compose src diff-rust-im.png
Comparision IM with libswscale:
bash
ffmpeg -i tiger.png -vf scale=540:360:flags=bilinear sws.png
compare sws.png im.png -compose src diff-sws-im.png