rustiff

Crates.iorustiff
lib.rsrustiff
version0.1.2
sourcesrc
created_at2018-09-04 13:43:16.688427
updated_at2018-09-17 07:53:14.651869
descriptionTIFF decoding/encoding library in Rust.
homepage
repositoryhttps://github.com/335g/rustiff
max_upload_size
id82918
size33,920
Yoshiki Kudo (335g)

documentation

README

rustiff

TIFF decoding/encoding library for Rust.

crates.io docs.rs

Use

Put this in your Cargo.toml:

[dependencies]
rustiff = "0.1"

Then put this in your crate root:

extern crate rustiff

Example

This example shows how to read TIFF data.

extern crate rustiff;

use rustiff::{
    Decoder,
    DecodeResult,
    DecodeError,
    Image,
    ImageData,
};
use std::fs::File;

fn main() -> DecodeResult<()> {
    let f = File::open("sample.tiff")?;
    let mut decoder = Decoder::new(f)?;
    let image = decoder.image()?;
    let image_data = image.data(); // Vec<u8> or Vec<u16>

    Ok(())
}

You can get the value associated with the tag.

extern crate rustiff;

use rustiff::{
    tag,
    IFD,
    Decoder,
    DecodeResult,
    DecodeError,
};
use std::fs::File;

fn main() -> DecodeResult<()> {
    let f = File::open("sample.tiff")?;
    let mut decoder = Decoder::new(f)?;
    let ifd = decoder.ifd()?;
    let width = decoder.get_value(&ifd, tag::ImageWidth)?;
    let height = decoder.get_value(&ifd, tag::ImageLength)?;

    Ok(())
}
Commit count: 65

cargo fmt