16 releases

0.1.15 Jun 10, 2018
0.1.14 Feb 15, 2018
0.1.13 Jun 14, 2017
0.1.11 Jan 9, 2017
0.1.2 Mar 8, 2016

#8 in Images

Download history 6452/week @ 2019-03-25 6024/week @ 2019-04-01 7891/week @ 2019-04-08 7517/week @ 2019-04-15 8468/week @ 2019-04-22 7712/week @ 2019-04-29 7271/week @ 2019-05-06 6316/week @ 2019-05-13 7333/week @ 2019-05-20 6242/week @ 2019-05-27 8008/week @ 2019-06-03 9511/week @ 2019-06-10 8478/week @ 2019-06-17 8578/week @ 2019-06-24 8362/week @ 2019-07-01

29,710 downloads per month
Used in 30 crates (5 directly)

MIT/Apache

102KB
2K SLoC

jpeg-decoder

Travis Build Status AppVeyor Build Status Crates.io

A Rust library for decoding JPEGs.

Documentation

Example

Cargo.toml:

[dependencies]
jpeg-decoder = "0.1"

main.rs:

extern crate jpeg_decoder as jpeg;

use std::fs::File;
use std::io::BufReader;

fn main() {
    let file = File::open("hello_world.jpg").expect("failed to open file");
    let mut decoder = jpeg::Decoder::new(BufReader::new(file));
    let pixels = decoder.decode().expect("failed to decode image");
    let metadata = decoder.info().unwrap();
}

lib.rs:

This crate contains a JPEG decoder.

Examples

use jpeg_decoder::Decoder;
use std::fs::File;
use std::io::BufReader;

let file = File::open("tests/reftest/images/extraneous-data.jpg").expect("failed to open file");
let mut decoder = Decoder::new(BufReader::new(file));
let pixels = decoder.decode().expect("failed to decode image");
let metadata = decoder.info().unwrap();

Get metadata from a file without decoding it:

use jpeg_decoder::Decoder;
use std::fs::File;
use std::io::BufReader;

let file = File::open("tests/reftest/images/extraneous-data.jpg").expect("failed to open file");
let mut decoder = Decoder::new(BufReader::new(file));
decoder.read_info().expect("failed to read metadata");
let metadata = decoder.info().unwrap();

Dependencies

~1.5MB
~29K SLoC