fix: black and white point should be set relative to quantum range

This commit is contained in:
Daniel Rönnkvist 2020-03-26 10:13:54 +01:00
parent 5c5015a10e
commit 36c145d4c4

View file

@ -257,8 +257,14 @@ impl MagickWand {
gamma: f64,
white_point: f64,
) -> Result<(), &'static str> {
let result =
unsafe { bindings::MagickLevelImage(self.wand, black_point, gamma, white_point) };
let result = unsafe {
bindings::MagickLevelImage(
self.wand,
black_point * bindings::QuantumRange,
gamma,
white_point * bindings::QuantumRange,
)
};
match result {
bindings::MagickBooleanType_MagickTrue => Ok(()),
_ => Err("failed to set size of wand"),