Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magiclen/image-convert
A high level library for image identification, conversion, interlacing and high quality resizing.
https://github.com/magiclen/image-convert
image rust
Last synced: 5 days ago
JSON representation
A high level library for image identification, conversion, interlacing and high quality resizing.
- Host: GitHub
- URL: https://github.com/magiclen/image-convert
- Owner: magiclen
- License: mit
- Created: 2018-08-13T02:36:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-28T08:39:51.000Z (24 days ago)
- Last Synced: 2024-12-08T07:04:42.589Z (14 days ago)
- Topics: image, rust
- Language: Rust
- Homepage:
- Size: 6.21 MB
- Stars: 27
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Image Convert
====================[![CI](https://github.com/magiclen/image-convert/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/image-convert/actions/workflows/ci.yml)
This crate is a high level library using **MagickWand** (ImageMagick) for image identification, conversion, interlacing and high quality resizing.
## Examples
Identify an image.
```rust
use image_convert::{ImageResource, InterlaceType, identify};let input = ImageResource::from_path("tests/data/P1060382.JPG");
let mut output = None;
let id = identify(&mut output, &input).unwrap();
assert_eq!(4592, id.resolution.width);
assert_eq!(2584, id.resolution.height);
assert_eq!("JPEG", id.format);
assert_eq!(InterlaceType::NoInterlace, id.interlace);
```Convert an image to a PNG image and also resize it.
```rust
use std::path::Path;use image_convert::{ImageResource, PNGConfig, to_png};
let source_image_path = Path::new("tests/data/P1060382.JPG");
let target_image_path = Path::join(source_image_path.parent().unwrap(), "P1060382_output.png");
let mut config = PNGConfig::new();
config.width = 1920;
let input = ImageResource::from_path(source_image_path);
let mut output = ImageResource::from_path(target_image_path);
to_png(&mut output, &input, &config).unwrap();
```Supported output formats are `BMP`, `JPG`, `PNG`, `GIF`, `WEBP`, `ICO`, `PGM` and `GrayRaw`.
## Crates.io
https://crates.io/crates/image-convert
## Documentation
https://docs.rs/image-convert
## License
[MIT](LICENSE)