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

#1 in Images

Download history 2561/week @ 2018-05-27 3921/week @ 2018-06-03 4188/week @ 2018-06-10 3978/week @ 2018-06-17 3388/week @ 2018-06-24 4088/week @ 2018-07-01 3910/week @ 2018-07-08 4033/week @ 2018-07-15 3479/week @ 2018-07-22 2857/week @ 2018-07-29 3947/week @ 2018-08-05 3282/week @ 2018-08-12 3340/week @ 2018-08-19

14,430 downloads per month
Used in 16 crates (4 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

~1MB
~24K SLoC