impl
This commit is contained in:
parent
e0de5360dd
commit
9ef32ef101
@ -1,6 +1,6 @@
|
||||
use std::sync::Once;
|
||||
|
||||
use magick_rust::{magick_wand_genesis, MagickWand};
|
||||
use magick_rust::{bindings::FilterType_LanczosFilter, magick_wand_genesis, MagickWand};
|
||||
use napi::{bindgen_prelude::Buffer, Error, Result, Status, Task};
|
||||
|
||||
static START: Once = Once::new();
|
||||
@ -34,8 +34,11 @@ impl LiquidRescaleTask {
|
||||
let wand = MagickWand::new();
|
||||
wand.read_image_blob(input_image)
|
||||
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?;
|
||||
let input_width = wand.get_image_width();
|
||||
let input_height = wand.get_image_height();
|
||||
wand.liquid_rescale_image(width, height, 0.0, 1.0)
|
||||
.map_err(|err| Error::new(Status::GenericFailure, format!("{err}")))?;
|
||||
wand.resize_image(input_width, input_height, FilterType_LanczosFilter);
|
||||
let output_image = wand
|
||||
.write_image_blob("JPEG")
|
||||
.map_err(|err| Error::new(Status::GenericFailure, format!("{err}")))?;
|
||||
|
Loading…
Reference in New Issue
Block a user