Free Support Forum -

Read BufferedImage

Hi there,

I was using the barcode reader by passing in a BufferedImage.

This functionality seems to have gone in the latest 5.4.0 version.

How do I do this now? I was using your example of reading from mulitple pages of a tiff file, which used BufferedImage.

Do I convert the BufferedImage to a BinarizedBitmap? how do I do this?


Hi Erik,

Thanks for your inquiry. You need to get InputStream from a BufferedImage. Please follow up the source code below:

BufferedImage image = GetBufferedImage();
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(image, “png”, os);
InputStream is = new ByteArrayInputStream(os.toByteArray());

I hope this will help you. Please let me know in case of further assistance and comments.