Crates.io | thumbnailer |
lib.rs | thumbnailer |
version | 0.5.1 |
source | src |
created_at | 2021-11-06 21:46:08.491823 |
updated_at | 2023-07-14 16:11:48.603136 |
description | An image thumbnail creation library |
homepage | |
repository | https://github.com/Trivernis/thumbnailer |
max_upload_size | |
id | 477852 |
size | 624,504 |
This crate can be used to create thumbnails for all kinds of files.
use thumbnailer::{create_thumbnails, Thumbnail, ThumbnailSize};
use std::fs::File;
use std::io::BufReader;
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 = Vec::new();
thumbnail.write_png(&mut buf).unwrap();
}
Type | Subtype |
---|---|
Image | Png |
Image | Bmp |
image | Jpeg |
Image | Webp |
Image | Gif |
MIT