I have one analyzer that sends me base64 of histogram of blood cells (you can see here https://i.imgur.com/QlIhc6O.png) , when i decode base64 string and get image directly from it , image cant be uploaded.Example of base64 :
AAAADiM9XXCAi5CUlpKLgHduZmBVS0A4MzAuKychHRoZGRkXFBEPDw4ODgwKCggICgoLCws==
I tried that
public static void main(String[] args) {
String base64Histogram = "AAAADiM9XXCAi5CUlpKLgHduZmBVS0A4MzAuKychHRoZGRkXFBEPDw4ODgwKCggICgoLCwsLCwwPERQZHiMpAA==";
try {
// Decode Base64 string
byte[] decodedBytes = Base64.getDecoder().decode(base64Histogram);
// Save the decoded binary data to an image file
String outputFilePath = "histogram.png";//also tried jpg format
FileOutputStream outputStream = new FileOutputStream(outputFilePath);
outputStream.write(decodedBytes);
outputStream.close();
System.out.println("Histogram image saved as: " + outputFilePath);
} catch (IOException e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
} result is that image saved but not loaded , it cant be seen
Just to show you what you have, here is what I get if I do a base64 decode and then plot the bytes as data points. I wrote this in Python because it's easier to plot from Python:
import base64
import matplotlib.pyplot as plt
inp = 'AAAADiM9XXCAi5CUlpKLgHduZmBVS0A4MzAuKychHRoZGRkXFBEPDw4ODgwKCggICgoLCwsLCwwPERQZHiMpAA=='
x = base64.b64decode(inp)
y = list(x)
plt.plot( y )
plt.show()