zune_image/
lib.rs

1/*
2 * Copyright (c) 2023.
3 *
4 * This software is free software; You can redistribute it or modify it under terms of the MIT, Apache License or Zlib license
5 */
6
7//! A fast and simple image processing library
8//!
9//! This ties up most of the independent crates and provides functionality
10//! between each one
11//!
12//!
13//! ## Features
14//! - The library crates include features for various formats anf filters
15//! - Decoders and encoders can be included or excluded at will
16//!
17//! ### Image decoders and encoders
18//! By default, a feature includes both format decoder and encoder if present.
19//!
20//!
21//!| Feature      | Decoder       | Encoder        |
22//!|--------------|---------------|----------------|
23//!| bmp          | zune-bmp      |     -          |
24//!| jpeg         | zune-jpeg     | [jpeg-encoder] |
25//!| png          | zune-png      | zune-png       |
26//!| ppm          | zune-ppm      | zune-ppm       |
27//!| qoi          | zune-qoi      | zune-qoi       |
28//!| farbfeld     | zune-farbfeld | zune-farbfeld  |
29//!| psd          | zune-psd      | -              |
30//!| jpeg-xl      | [jxl-oxide]   | zune-jpegxl    |
31//!| hdr          | zune-hdr      | zune-hdr       |
32//!
33//!
34//! ### Image filters
35//!
36//! Image filters are divided into two types,
37//!  - core filters: Things needed to enable conversions from one format to another.
38//!                 This may include color conversion and depth conversion routines.
39//!                 These are in `zune-image` crate
40//!  - extra filters: This include algorithms that do more complex pixel manipulations,
41//!     including contrast adjustment, resizing, blurring etc, the algorithms are usually
42//!     implemented in `zune-imageprocs` by the processes implementing
43//!     [OperationsTrait](crate::traits::OperationsTrait)
44//!
45//!  # High level api
46//! Load images using image `open`
47//!
48//!```no_run
49//! use zune_image::errors::ImageErrors;
50//! use zune_image::image::Image;
51//!        
52//! let image = Image::open("file.png")?;
53//!
54//!# Ok::<(),ImageErrors>(())
55//! ```
56//!  Or if the image is in memory load it via [`Image.read`](crate::image::Image::read)
57//!
58//!```no_run
59//! use zune_core::bytestream::ZCursor;
60//! use zune_core::options::DecoderOptions;
61//! use zune_image::image::Image;
62//! use zune_image::errors::ImageErrors;
63//! let mem_src = [0;100];
64//! let image = Image::read(ZCursor::new(&mem_src),DecoderOptions::default())?;
65//! # Ok::<(),ImageErrors>(())
66//!
67//! ```
68//! You can save files via [`Image.save`](crate::image::Image::save)
69//! which takes a file name and uses the extension to determine the file type, or
70//! [`Image.save_to`](crate::image::Image::save_to) which takes an additional format field
71//! or [`Image.write_to_vec`](crate::image::Image::write_to_vec) which writes image contents to memory
72//! locations
73//!
74//!
75//!  ### Image and frames
76//! An image may consist of one or more frames, an image with more than one frame is considered
77//! animated, each frame of an animated image should have the same color channels and length.
78//!
79//! You can iterate the frames via the `frames_` method ([`frames_ref`](image::Image::frames_ref)
80//! and [`frames_mut`](image::Image::frames_mut)
81//!
82//! ### Image and channels
83//!
84//! The channels api ([`channels_ref`](image::Image::channels_ref) and [`channels_mut`](image::Image::channels_mut) provide
85//! convenient methods to access image channels. This returns all image channels,traversing frames and concatenating it together
86//!
87//!
88//![image]:https://crates.io/crates/image
89//! [jpeg-encoder]: https://crates.io/crates/jpeg-encoder
90//! [jxl-oxide]: https://crates.io/crates/jxl-oxide
91#![allow(
92    clippy::redundant_field_names,
93    clippy::uninlined_format_args,
94    rustdoc::redundant_explicit_links
95)]
96#![cfg_attr(feature = "benchmarks", feature(test))]
97#![cfg_attr(feature = "docs", feature(doc_cfg))]
98extern crate core;
99
100pub mod channel;
101pub mod codecs;
102pub mod core_filters;
103mod deinterleave;
104pub mod errors;
105pub mod frame;
106pub mod image;
107pub mod metadata;
108mod ops;
109pub mod pipelines;
110mod serde;
111mod tests;
112pub mod traits;
113pub mod utils;