Crates.io | zune-imageprocs |
lib.rs | zune-imageprocs |
version | 0.5.0-rc0 |
source | src |
created_at | 2023-11-17 18:46:52.787389 |
updated_at | 2024-04-26 13:05:24.108019 |
description | Common image processing routines for zune-image |
homepage | |
repository | https://github.com/etemesi254/zune-image/tree/dev/crates/zune-imageprocs |
max_upload_size | |
id | 1039392 |
size | 298,765 |
A library for low level image processing routines
They work on raw pixels (T
) and they are focused on speed and safety.
Some filters are in alpha stage, and some are broken,
don't use a filter with a Broken
tag
Add the crate to your dependencies e.g cargo add zune-imageprocs
After that one can use the processing routines since they implement zune-image
OperationsTrait
, anywhere that supports them
can call on them
E.g. to increase the exposure of an image
use zune_core::colorspace::ColorSpace;
use zune_image::errors::ImageErrors;
use zune_image::image::Image;
use zune_image::traits::OperationsTrait;
use zune_imageprocs::exposure::Exposure;
fn main()->Result<(),ImageErrors> {
// create a 100x100 grayscale image
let mut img = Image::from_fn::<u16, _>(100, 100, ColorSpace::Luma, |x, y, pix| {
pix[0] = ((x + y) % 65536) as u16;
});
// increase each pixels strength by 2
Exposure::new(2.0, 0.0).execute(&mut img)?;
// write to a file
img.save("hello.png")?;
}
portable-simd
: This adds support for portable simd, requires a nightly compiler.
Some routines are written in portable simd and hence this can speed up some computations.
threads
: Adds support for multithreading on image filters, some filters can run independently per channel,
especially computational heavy filters, this enables that. On platforms without multithtreading (e.g wasm
), this should
be disabled
Most routines in the library can be benchmarked, but they require a nightly compiler
To test speed of most routines run
cargo bench --features=benchmarks