I am using below code to convert base64 data to png image using java code but it always results in empty image. If i use the same base64 data to image in online services it works fine, below is the code, is there any issue with this code?
byte[] data = Base64.decodeBase64(imageInBase64);
System.out.println("Writing steam... " + data);
try (OutputStream stream = new FileOutputStream(new File("c:\\test.png"))) {
stream.write(data);
}
System.out.println("Converted..");
Aucun commentaire:
Enregistrer un commentaire