Hi,
For some reason I can not get BMP (Bit Map) files to be recognized by the BarCodeReader. I tried this with 2.6.0 and 2.7.0.
Here is the code I used to generate the bar code:
public class SimpleSample {
public static final void main(String args[]) {
com.aspose.barcode.License lic = new License();
lic.setLicense(“resources\\Aspose.Barcode.lic”);
BarCodeBuilder b = new BarCodeBuilder();
b.setAutoSize(true);
b.setSymbology(Symbology.QR);
b.setCodeText(“12345678”);
b.setCodeTextVisible(false);
b.save(“c:\test.bmp”, “bmp”); //I tried this without the second param as well
}
}
Here is the code I wrote to read the file:
public class ReadSingleImage {
public static void main(String… args) {
new ReadSingleImage().read();
}
private void read() {
initLicense();
Image image = Toolkit.getDefaultToolkit().getImage(“c:\test.bmp”);
BarCodeReader barCodeReader = new BarCodeReader(image, BarCodeReadType.QR);
while(barCodeReader.read()) {
System.out.println("Found " + barCodeReader.getCodeText());
}
}
private void initLicense() {
License license = new License();
license.setLicense(“resources\Aspose.Barcode.lic”);
}
}
Here is the error I get:
Exception in thread “main” com.aspose.barcoderecognition.BarCodeRecognitionException: Not supported format
at com.aspose.barcoderecognition.al.getBufferedImage(SourceFile:357)
at com.aspose.barcoderecognition.an.(SourceFile:21)
at com.aspose.barcoderecognition.BarCodeReader.a(SourceFile:117)
at com.aspose.barcoderecognition.BarCodeReader.(SourceFile:88)
at test.ReadSingleImage.read(ReadSingleImage.java:22)
at test.ReadSingleImage.main(ReadSingleImage.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Please let me know if there is something I am doing wrong or if there is a bug with the Aspose API. I have been successfully able to read in JPEG, PNG, and TIFF (via JAI).
I’ve attached the image. I had to name it “test.bmp.jpg” to upload it since “bmp” is not a valid extension. Why is that? It is a Bit Map file. Please remove the “.jpg” from the file name before using.
Thank you,
Todd
Hi again,
Hi Babar,
Thank you for looking at this so quickly. I had tried other BMP files (ones generated by a separate process) and they didn’t work either.
I have two follow up questions:
1) If BMP is not a supported format for saving, then how was the image successfully created by the code above?
2) Being a software engineer myself, I understand release cycles. Is this something that would get changed in a “patch” release in the near future or will it get changed in a major release down the road? Can you give me any type of ETA? Weeks, months, etc.? Also, how do I track that ID: 32502?
Thanks again,
Todd
Hi Todd,
The issues you have found earlier (filed as BARCODJAVA-32502) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.