tiny_tiff/
lib.rs

1//! # tiny_tiff
2//!
3//! `tiny_tiff` is a wrapper for the TinyTIFF C++ library. It enables easy reading and writing of
4//! uncompressed TIFF images with uint, int, or float data types.
5//!
6//! DEPENDANCIES
7//! ============
8//!
9//! - `git clone https://github.com/rngoodner/TinyTIFF.git`
10//! - `cd TinyTIFF`
11//! - `mkdir build`
12//! - `cd build`
13//! - `cmake ..`
14//! - `make -j`
15//! - `sudo make install`
16//!
17//! SYNOPSIS
18//! ========
19//!
20//! ```
21//! extern crate tiny_tiff;
22//!
23//! use tiny_tiff::reader;
24//! use tiny_tiff::writer;
25//!
26//! // read
27//! let tiff = reader::open("./tests/test_data/cell32.tif").unwrap();
28//! let bits = reader::bits_per_sample(tiff, 0);
29//! let width = reader::width(tiff);
30//! let height = reader::height(tiff);
31//! let size = width * height;
32//! let mut buffer: Vec<f32> = vec![0f32; size as usize];
33//! reader::sample_data(tiff, &mut buffer, 0);
34//! reader::close(tiff);
35//!
36//! // manipulate
37//! for px in &mut buffer {
38//!     *px += 42f32;
39//! }
40//!
41//! // write
42//! let tiff = writer::open("./tests/test_data/cell32_example.tif", bits, width, height).unwrap();
43//! writer::write_image_float(tiff, &buffer);
44//! writer::close(tiff, "cell32 + 42!");
45//! ```
46
47extern crate libc;
48
49pub mod reader;
50pub mod writer;