#tiff #image #graphics

tiny_tiff

tiny_tiff is a wrapper for the TinyTIFF C++ library. It enables easy reading and writing of uncompressed TIFF images with uint, int, and float data types.

7 releases (4 breaking)

0.5.2 Aug 26, 2022
0.5.1 Dec 8, 2019
0.5.0 Jan 12, 2019
0.4.0 Jan 11, 2019
0.1.0 Dec 27, 2018

#313 in Images

Download history 14/week @ 2023-12-21 9/week @ 2023-12-28 27/week @ 2024-01-04 7/week @ 2024-01-11 16/week @ 2024-01-18 20/week @ 2024-01-25 22/week @ 2024-02-01 63/week @ 2024-02-08 62/week @ 2024-02-15 81/week @ 2024-02-22 67/week @ 2024-02-29 60/week @ 2024-03-07 79/week @ 2024-03-14 104/week @ 2024-03-21 143/week @ 2024-03-28

403 downloads per month

MIT/Apache

77KB
361 lines

tiny_tiff

tiny_tiff is a wrapper for the TinyTIFF C++ library. It enables easy reading and writing of uncompressed TIFF images with uint, int, or float data types.

DEPENDANCIES

  • git clone https://github.com/rngoodner/TinyTIFF.git
  • cd TinyTIFF
  • mkdir build
  • cd build
  • cmake ..
  • make -j
  • sudo make install

DOCUMENTATION

cargo doc --open

COPYRIGHT AND LICENSE

Copyright 2022 rngoodner

This library is free software; you can redistribute it and/or modify it under the MIT or APACHE-2.0 licenses.


lib.rs:

tiny_tiff

tiny_tiff is a wrapper for the TinyTIFF C++ library. It enables easy reading and writing of uncompressed TIFF images with uint, int, or float data types.

DEPENDANCIES

  • git clone https://github.com/rngoodner/TinyTIFF.git
  • cd TinyTIFF
  • mkdir build
  • cd build
  • cmake ..
  • make -j
  • sudo make install

SYNOPSIS

extern crate tiny_tiff;

use tiny_tiff::reader;
use tiny_tiff::writer;

// read
let tiff = reader::open("./tests/test_data/cell32.tif").unwrap();
let bits = reader::bits_per_sample(tiff, 0);
let width = reader::width(tiff);
let height = reader::height(tiff);
let size = width * height;
let mut buffer: Vec<f32> = vec![0f32; size as usize];
reader::sample_data(tiff, &mut buffer, 0);
reader::close(tiff);

// manipulate
for px in &mut buffer {
    *px += 42f32;
}

// write
let tiff = writer::open("./tests/test_data/cell32_example.tif", bits, width, height).unwrap();
writer::write_image_float(tiff, &buffer);
writer::close(tiff, "cell32 + 42!");

Dependencies