Add README and crates.io metadata

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent cf3ad87360
commit a18bafb39e
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

1
.gitignore vendored

@ -1,2 +1,3 @@
/target /target
Cargo.lock Cargo.lock
.idea

8
.idea/.gitignore vendored

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/thumbnailer.iml" filepath="$PROJECT_DIR$/.idea/thumbnailer.iml" />
</modules>
</component>
</project>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -1,5 +1,9 @@
[package] [package]
name = "thumbnailer" name = "thumbnailer"
readme = "README.md"
license = "Apache-2.0"
authors = ["trivernis <trivernis@protonmail.com>"]
description = "An image thumbnail creation library"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2018"

@ -0,0 +1,35 @@
# 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

@ -1,3 +1,24 @@
//! # 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;
//!
//! 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();
//! }
//! ```
use crate::error::ThumbResult; use crate::error::ThumbResult;
use image; use image;
use image::imageops::FilterType; use image::imageops::FilterType;

Loading…
Cancel
Save