0

I am using third-party software to capture a signature that returns an Image class reference object. I can only get a primitive byte array from it though. I need to convert this image to base 64 so I can use it in an HTML template I am generating. But before converting it to a base 64 encoding, I would like to resize/scale it down. This image object is not being stored in the device so casting it to a Bitmap has proved troublesome, and my API version does not have support for BufferedImage. Since all suggestions require the image to be in those two formats, I seem to be stuck. Has anyone here ran into a similar problem?

*the third-party software and the device hardware specifications are proprietary so I cannot share that information

I am using java 8 Android sdk compile version 30 (Android 11)

capture the signature

Image signiture = pos.getSignature();

// TODO add logic to resize the image before conversion to base 64

Base64.getEncoder().encodeToString(signiture.getData());

here are some sources I have looked into without much luck

Scale an image which is stored as a byte[] in Java

How to resize image (Bitmap) to a given size?

Base64 Image will not scale down using any common methods

Shay Ribera
  • 316
  • 5
  • 17

0 Answers0