Good afternoon, I'm starting to program with zxing, my question is this: I'm trying to read a barcode, this is my source code:
private static String readBarcode(String pathname) throws FormatException, ChecksumException, NotFoundException, IOException {
InputStream qrInputStream = new FileInputStream(pathname);
BufferedImage qrBufferedImage = ImageIO.read(qrInputStream);
LuminanceSource source = new BufferedImageLuminanceSource(qrBufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new MultiFormatReader();
Result stringBarCode = reader.decode(bitmap);
return stringBarCode.getText();
}
The error that it generates is:
java.lang.NullPointerException at com.google.zxing.client.j2se.BufferedImageLuminanceSource. (BufferedImageLuminanceSource.java:39)
at testWS.TestZXing.readBarcode (TestZXing.java:78)
at testWS.TestZXing.main (TestZXing.java:50)
I leave an image of the bar code that I am trying to read.