resize
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
Usage
use RGB24;
use Lanczos3;
// Downscale by 2x.
let = ;
let = ;
// Don't forget to fill `src` with image data (RGB24).
let src = vec!;
// Destination buffer. Must be mutable.
let mut dst = vec!;
// Create reusable instance.
let mut resizer = new;
// Do resize without heap allocations.
// Might be executed multiple times for different `src` or `dst`.
resizer.resize;
See API documentation for overview of all available methods. See also this example.
Recommendations
Read this and this great articles on image resizing technics and resampling filters. Tldr; (with built-in filters of this library) use Lanczos3
for downscaling, use Mitchell
for upscaling. You may also want to downscale in linear colorspace (but not upscale). Gamma correction routines currently not included to the library, but actually quite simple to accomplish manually, see here for some basic theory.
License
- Library is licensed under MIT
- Image used in examples is licensed under CC BY-SA 3.0