Crate zune_image
source ·Expand description
A fast and simple image processing library
This ties up most of the independent crates and provides functionality between each one
§Features
- The library crates include features for various formats anf filters
- Decoders and encoders can be included or excluded at will
§Image decoders and encoders
By default, a feature includes both format decoder and encoder if present.
Feature | Decoder | Encoder |
---|---|---|
bmp | zune-bmp | - |
jpeg | zune-jpeg | jpeg-encoder |
png | zune-png | zune-png |
ppm | zune-ppm | zune-ppm |
qoi | zune-qoi | zune-qoi |
farbfeld | zune-farbfeld | zune-farbfeld |
psd | zune-psd | - |
jpeg-xl | jxl-oxide | zune-jpegxl |
hdr | zune-hdr | zune-hdr |
§Image filters
Image filters are divided into two types,
- core filters: Things needed to enable conversions from one format to another.
This may include color conversion and depth conversion routines.
These are in
zune-image
crate - extra filters: This include algorithms that do more complex pixel manipulations,
including contrast adjustment, resizing, blurring etc, the algorithms are usually
implemented in
zune-imageprocs
by the processes implementing OperationsTrait
§High level api
Load images using image open
use zune_image::errors::ImageErrors;
use zune_image::image::Image;
let image = Image::open("file.png")?;
Or if the image is in memory load it via Image.read
use zune_core::options::DecoderOptions;
use zune_image::image::Image;
use zune_image::errors::ImageErrors;
let mem_src = [0;100];
let image = Image::read(&mem_src,DecoderOptions::default())?;
You can save files via Image.save
which takes a file name and uses the extension to determine the file type, or
Image.save_to
which takes an additional format field
or Image.write_to_vec
which writes image contents to memory
locations
§Image and frames
An image may consist of one or more frames, an image with more than one frame is considered animated, each frame of an animated image should have the same color channels and length.
You can iterate the frames via the frames_
method (frames_ref
and frames_mut
§Image and channels
The channels api (channels_ref
and channels_mut
provide
convenient methods to access image channels. This returns all image channels,traversing frames and concatenating it together
Modules§
- This module encapsulates a single image channel instance
- Entry point for all supported codecs the library understands
- Filters that cannot be disabled
- Errors possible during image processing
- A single image frame
- This module represents a single image, an image can consists of one or more
- Image metadata
- Pipelines, Batch image processing support
- Various encapsulations of common image operations
- A set of miscellaneous functions that are good to have