Skip to main content

exr/
lib.rs

1//! Read and write OpenEXR images.
2//! This library uses no foreign code or unsafe Rust.
3//!
4//! See the [README.md](https://github.com/johannesvollmer/exrs/blob/master/README.md) for crate information.
5//! Read __the [GUIDE.md](https://github.com/johannesvollmer/exrs/blob/master/GUIDE.md) for a API introduction__.
6//! Check out the [examples](https://github.com/johannesvollmer/exrs/tree/master/examples) for a first impression.
7
8#![warn(
9    rust_2018_idioms,
10    future_incompatible,
11    unused_extern_crates,
12    unused,
13    missing_copy_implementations,
14    missing_debug_implementations,
15    clippy::all,
16    clippy::pedantic,
17    clippy::nursery,
18    clippy::cargo
19)]
20#![deny(
21    unused_variables,
22    unused_assignments,
23    dead_code,
24    unused_must_use,
25    missing_copy_implementations,
26    trivial_numeric_casts,
27    redundant_semicolons
28)]
29#![forbid(unsafe_code)]
30#![warn(missing_docs)]
31
32pub mod io; // public to allow for custom attribute byte parsing
33
34pub mod compression;
35pub mod image;
36pub mod math;
37pub mod meta;
38
39pub mod block;
40pub mod error;
41
42#[macro_use]
43extern crate smallvec;
44
45/// Export the most important items from `exrs`.
46/// _Note: This includes a type called `Result`, possibly overwriting the
47/// default `std::Result` type usage._
48pub mod prelude {
49
50    /// Import this specifically if you want to be explicit but still use the
51    /// extension traits.
52    pub mod traits {
53        pub use crate::image::{
54            crop::{ApplyCroppedView, Crop, CropResult, CropWhere, CroppedChannels, InspectSample},
55            read::{
56                any_channels::ReadSamples,
57                image::{ReadImage, ReadLayers},
58                layers::ReadChannels,
59                read,
60                specific_channels::ReadSpecificChannel,
61            },
62            write::{channels::GetPixel, WritableImage},
63        };
64    }
65
66    // re-export external stuff
67    pub use half::f16;
68    pub use smallvec::SmallVec;
69    pub use traits::*;
70
71    // error handling
72    pub use crate::error::{Error, Result};
73    pub use crate::image::{
74        read::{
75            read_all_data_from_file, read_all_flat_layers_from_file,
76            read_all_rgba_layers_from_file, read_first_flat_layer_from_file,
77            read_first_rgba_layer_from_file,
78        },
79        write::{write_rgb_file, write_rgba_file},
80    };
81    // common math
82    pub use crate::math::Vec2;
83    // image data structures
84    pub use crate::{
85        block::samples::Sample,
86        image::*,
87        meta::{
88            attribute,
89            attribute::{
90                AttributeValue, ChannelDescription, Compression, IntegerBounds, LineOrder,
91                SampleType, Text, TileDescription,
92            },
93            header::{ImageAttributes, LayerAttributes},
94            MetaData,
95        },
96    };
97}