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 2869/week @ 2018-09-19 3943/week @ 2018-09-26 4164/week @ 2018-10-03 3440/week @ 2018-10-10 5230/week @ 2018-10-17 4936/week @ 2018-10-24 6033/week @ 2018-10-31 5313/week @ 2018-11-07 6443/week @ 2018-11-14 5775/week @ 2018-11-21 4938/week @ 2018-11-28 4689/week @ 2018-12-05 5025/week @ 2018-12-12

14,430 downloads per month
Used in 20 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

~1.5MB
~25K SLoC