#image-resizing #image-conversion #image #resize #conversion #format-conversion #interlacing

image-convert

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

48 releases

0.19.0 Nov 28, 2024
0.17.1 Aug 11, 2024
0.16.1 Dec 9, 2023
0.15.0 Sep 7, 2023
0.8.9 Jul 28, 2019

#120 in Images

Download history 17/week @ 2024-08-23 194/week @ 2024-08-30 36/week @ 2024-09-06 39/week @ 2024-09-13 142/week @ 2024-09-20 126/week @ 2024-09-27 69/week @ 2024-10-04 34/week @ 2024-10-11 20/week @ 2024-10-18 22/week @ 2024-10-25 50/week @ 2024-11-01 35/week @ 2024-11-08 100/week @ 2024-11-15 185/week @ 2024-11-22 257/week @ 2024-11-29 1034/week @ 2024-12-06

1,579 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.

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.

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

~3.5–6.5MB
~119K SLoC