#image #resize #imagemagick #conversion #interlacing

image-convert

A high level library for image identification, conversion, interlacing and high quality resizing

33 releases

0.10.4 Apr 21, 2021
0.10.3 Mar 10, 2021
0.10.2 Aug 4, 2020
0.9.12 Jul 29, 2020
0.8.9 Jul 28, 2019

#35 in Images

Download history 63/week @ 2021-01-15 24/week @ 2021-01-22 11/week @ 2021-01-29 63/week @ 2021-02-05 274/week @ 2021-02-12 64/week @ 2021-02-19 16/week @ 2021-02-26 29/week @ 2021-03-05 21/week @ 2021-03-12 105/week @ 2021-03-19 83/week @ 2021-03-26 80/week @ 2021-04-02 16/week @ 2021-04-09 155/week @ 2021-04-16 68/week @ 2021-04-23 55/week @ 2021-04-30

291 downloads per month
Used in 4 crates

MIT license

61KB
1.5K SLoC

Image Convert

CI

This crate is a high level library using MagickWand (ImageMagick) for image identification, conversion, interlacing and high quality resizing.

Examples

Identify an image.

extern crate image_convert;

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.

extern crate image_convert;

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

Dependencies

~2.6–5MB
~110K SLoC