Free Support Forum - aspose.com

BarCodeRecognitionException: Not supported format... For BMP?

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 Todd,

Thank you for your inquiry.

I am experiencing the same exception while reading your provided file. The reason can be that you have saved the barcode to BMP and that is not one of the supported formats for saving the barcode. Please check the below link,
http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/save-barcode-images-to-different-formats.html

On other hand, BMP is one of the supported formats for recognition so any other image format when converted to BMP should work. I am exploring these possibilities and will keep you posted with my results.

We apologize for your inconvenience.

Hi again,


I am afraid, I was unable to process any BMP file for recognition purposes. So I have logged a ticket (id: 32502) in our tracking system to rectify the issue. As soon as we receive any updates, we will post that here.

Thank you for your patience.

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,


1) I am still looking for the reason. I will post it here as soon as I figure this out.

2) I am afraid, at the moment we do not have any updates regarding the next release. I will inquire this from the concerned development team and will update here. Once your issue is fixed, we can also provide you a Hotfix version if you like.

You can check the status of your reported issue at left hand side of your original thread. It says “Unresolved” at the moment. It will be changed to “Resolved” when fixed. Please check the snapshot attached for your reference.

Regards,

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.