Image scaling library in Rust
Rust image scale in different color spaces using SIMD and multithreading.
Supported only NEON and SSE.
Colorspace
This library provides for you some conveniences to scale in different color spaces.
Example integration with image crate
let img = open
.unwrap
.decode
.unwrap;
let dimensions = img.dimensions;
let mut bytes = Vecfrom;
let mut scaler = new;
scaler.set_threading_policy;
let store =
from_slice;
let resized = scaler.resize_rgba;
Performance
Faster or comparable to fast-image-resize, when implemented equal SIMD and pixel type.
Example comparison time for downscale RGB 4928x3279 image in two times for x86_64 SSE.
| Lanczos3 | |
|---|---|
| pic-scale | 26.13 |
| fir sse | 26.84 |
M3 Pro. NEON
| Lanczos3 | |
|---|---|
| pic-scale | 23.04 |
| fir sse | 37.00 |
Example comparison time for downscale RGBA 4928x3279 image in two times for x86_64 SSE with premultiplying alpha.
| Lanczos3 | |
|---|---|
| pic-scale | 42.35 |
| fir sse | 42.96 |
M3 Pro. NEON
| Lanczos3 | |
|---|---|
| pic-scale | 47.45 |
| fir sse | 53.81 |
Example comparison time for downscale RGBA 4928x3279 image in two times for x86_64 SSE without premultiplying alpha.
| Lanczos3 | |
|---|---|
| pic-scale | 26.92 |
| fir sse | 38.30 |
M3 Pro. NEON
| Lanczos3 | |
|---|---|
| pic-scale | 38.75 |
| fir sse | 45.79 |
Example in sRGB
In common, you should not downsize an image in sRGB colorspace, however if speed is more preferable than more proper scale you may omit linearizing
let mut scaler = new;
scaler.set_threading_policy;
let store =
from_slice;
let resized = scaler.resize_rgba;
Example in linear
At the moment only sRGB transfer function is supported. This is also good optimized path so it is reasonably fast.
let mut scaler = new;
scaler.set_threading_policy;
let store =
from_slice;
let resized = scaler.resize_rgba;
Example in CIE L*a*b
let mut scaler = new;
scaler.set_threading_policy;
let store =
from_slice;
let resized = scaler.resize_rgba;
Example in CIE L*u*v
let mut scaler = new;
scaler.set_threading_policy;
let store =
from_slice;
let resized = scaler.resize_rgba;
Resampling filters
Over 30 resampling filters is supported.
Bilinear,
Nearest,
Cubic,
MitchellNetravalli,
CatmullRom,
Hermite,
BSpline,
Hann,
Bicubic,
Hamming,
Hanning,
Blackman,
And others