We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d01ec9 commit e4ad28cCopy full SHA for e4ad28c
src/lib.rs
@@ -325,7 +325,7 @@ pub fn decode_barcode(
325
/// Such an object could be obtained using the `getImageData`
326
/// method of a `CanvasRenderingContext2D` object.
327
pub fn convert_js_image_to_luma(data: &[u8]) -> Vec<u8> {
328
- let mut luma_data = Vec::new();
+ let mut luma_data = Vec::with_capacity(data.len() / 4);
329
for src_pixel in data.chunks_exact(4) {
330
let [red, green, blue, alpha] = src_pixel else {
331
continue;
0 commit comments