You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
764 B
Markdown
35 lines
764 B
Markdown
3 years ago
|
# Thumbnailer
|
||
|
|
||
|
This crate can be used to create thumbnails for all kinds of files.
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```rust
|
||
|
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();
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Supported media types
|
||
|
|
||
|
| Type | Subtype |
|
||
|
|-------|---------|
|
||
|
| Image | Png |
|
||
|
| Image | Bmp |
|
||
|
| image | Jpeg |
|
||
|
| Image | Webp |
|
||
|
| Image | Gif |
|
||
|
|
||
|
## License
|
||
|
|
||
|
MIT
|