|
|
@ -16,23 +16,14 @@ Future<Code> zxingReadBarcodeImagePath( |
|
|
|
DecodeParams? params, |
|
|
|
DecodeParams? params, |
|
|
|
}) async { |
|
|
|
}) async { |
|
|
|
final Uint8List imageBytes = await path.readAsBytes(); |
|
|
|
final Uint8List imageBytes = await path.readAsBytes(); |
|
|
|
final imglib.Image? image = imglib.decodeImage(imageBytes); |
|
|
|
imglib.Image? image = imglib.decodeImage(imageBytes); |
|
|
|
|
|
|
|
|
|
|
|
if (image == null) { |
|
|
|
if (image == null) { |
|
|
|
return Code(); |
|
|
|
return Code(); |
|
|
|
} |
|
|
|
} |
|
|
|
// image = resizeToMaxSize(image, params?.maxSize); |
|
|
|
image = resizeToMaxSize(image, params?.maxSize); |
|
|
|
|
|
|
|
|
|
|
|
// imglib.Image imgRgba8 = image.convert( |
|
|
|
|
|
|
|
// format: imglib.Format.uint8, |
|
|
|
|
|
|
|
// numChannels: 4, |
|
|
|
|
|
|
|
// ); // Make sure it's an RGBA 32-bit image like v3 |
|
|
|
|
|
|
|
// imgRgba8 = |
|
|
|
|
|
|
|
// imglib.grayscale(imgRgba8); // map the pixels to grayscale (luminance) |
|
|
|
|
|
|
|
// final Uint8List bytes = imgRgba8.getBytes(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return zxingReadBarcode( |
|
|
|
return zxingReadBarcode( |
|
|
|
image.toUint8List(), //.getBytes(format: imglib.Format.luminance), |
|
|
|
grayscaleBytes(image), |
|
|
|
width: image.width, |
|
|
|
width: image.width, |
|
|
|
height: image.height, |
|
|
|
height: image.height, |
|
|
|
params: params, |
|
|
|
params: params, |
|
|
@ -52,7 +43,7 @@ Future<Code> zxingReadBarcodeImageUrl( |
|
|
|
} |
|
|
|
} |
|
|
|
image = resizeToMaxSize(image, params?.maxSize); |
|
|
|
image = resizeToMaxSize(image, params?.maxSize); |
|
|
|
return zxingReadBarcode( |
|
|
|
return zxingReadBarcode( |
|
|
|
image.toUint8List(), //.getBytes(format: imglib.Format.luminance), |
|
|
|
grayscaleBytes(image), |
|
|
|
width: image.width, |
|
|
|
width: image.width, |
|
|
|
height: image.height, |
|
|
|
height: image.height, |
|
|
|
params: params, |
|
|
|
params: params, |
|
|
|