Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Move variable assignment out of loop

Surma36293d756b8c
diff --git a/codecs/resize/pkg/squoosh_resize_bg.wasm b/codecs/resize/pkg/squoosh_resize_bg.wasm
index a1f04051..0a10cca3 100644
Binary files a/codecs/resize/pkg/squoosh_resize_bg.wasm and b/codecs/resize/pkg/squoosh_resize_bg.wasm differ
diff --git a/codecs/resize/src/lib.rs b/codecs/resize/src/lib.rs
index 798e34dc..bb7df8ad 100644
--- a/codecs/resize/src/lib.rs
+++ b/codecs/resize/src/lib.rs
@@ -107,8 +107,8 @@ pub fn resize(
to_linear(input_image[4 * i + j]),
(input_image[4 * i + 3] as f32) / 255.0,
);
- preprocessed_input_image[4 * i + 3] = (input_image[4 * i + 3] as f32) / 255.0;
}
+ preprocessed_input_image[4 * i + 3] = (input_image[4 * i + 3] as f32) / 255.0;
}
let mut unprocessed_output_image = vec![0.0f32; num_output_pixels * 4];