nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
254 stars 68 forks source link

Create MagickWand and fill with raw RGBA #95

Open Jacherr opened 2 years ago

Jacherr commented 2 years ago

Might be an easily answered question if I looked harder, but is it possible to take a raw RGBA buffer and pass it to ImageMagick using this crate?

I imagine it will be some mixture of read_image_blob, but I need some way to tell ImageMagick the dimensions of the image. Am I on the right track, or is this not possible at the moment?

nlfiedler commented 2 years ago

I don't know enough about ImageMagick to know, hopefully someone else can chime in.

jshrake commented 1 year ago

This is possible using MagickWand::import_image_pixels method (https://imagemagick.org/api/magick-image.php#MagickImportImagePixels). See this PR https://github.com/nlfiedler/magick-rust/pull/99, which improves the existing API and adds a unit test that demonstrates how to use it.