Crate thumbnailer
source ·Expand description
Thumbnailer
This crate can be used to generate thumbnails for all kinds of files.
Example:
use thumbnailer::{create_thumbnails, Thumbnail, ThumbnailSize};
use std::fs::File;
use std::io::BufReader;
use std::io::Cursor;
fn main() {
let file = File::open("tests/assets/test.png").unwrap();
let reader = BufReader::new(file);
let mut thumbnails = create_thumbnails(reader, mime::IMAGE_PNG, [ThumbnailSize::Small, ThumbnailSize::Medium]).unwrap();
let thumbnail = thumbnails.pop().unwrap();
let mut buf = Cursor::new(Vec::new());
thumbnail.write_png(&mut buf).unwrap();
}
Modules
Structs
Enums
- Represents fixed sizes of a thumbnail
Functions
- Creates thumbnails of the requested sizes for the given reader providing the content as bytes and the mime describing the contents type