Java code for image converter

Hi , I’m trying to convert the fingerprint image to wsq “encoded image” file using image uploader

And i found this post , with Java code to convert the image to wsq , how i can apply this code with bubble io so it would convert the image to wsq file , the code below , Thank you you

// 1. Read files to BufferedImage for get width, height. Convert Bit depth to 8-gray
BufferedImage bufferedImage =;

// 2. Convert Bit depth to 8-gray (This is what i had to do to solve this problem)
BufferedImage img = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
Graphics g = img.getGraphics();
g.drawImage(bufferedImage, 0, 0, null);

// 3. Convert file format to byte[] and convert to type Bitmap
WritableRaster raster = img.getRaster();
DataBufferByte data = (DataBufferByte) raster.getDataBuffer();
Bitmap bitmap = new Bitmap(data.getData(), bufferedImage.getWidth(), bufferedImage.getHeight(), 500, 8, 1);

// 4. Create file wsq
OutputStream outputStream = new FileOutputStream("c.wsq");
double bitrate = 0.75f;
String commentText = "";

// 5. Write the input file to the generated wsq file
WSQEncoder.encode(outputStream, bitmap, bitrate, commentText);

Hi @arumizan :wave:
I don’t think it is possible to integrate JAVA in bubble.
Bubble supports only javascript.

1 Like

Hey @anthony.viel
Thank you for the replay , I know that the integration could be done , between the endpoints , but as I saw here its java library.

I have no idea how to make the integration here

This topic was automatically closed after 70 days. New replies are no longer allowed.