Hi all. If I have a byte representing a PNG image, can I convert the byte into a String and then back to byte and Image? I've tried the code below but the second image gets very degradated.
The conversion is Image->byte->String->byte->Image
I am sure that the first byte is correct and represents the image correctly.
byte imgData; // bytes representing an image
Image img = Image.createImage(imgData, 0, imgData.length);
[SHOW IMG] // Showing img is OK here
String s = new String(imgData); // create String from image bytes
byte imgData2 = s.getBytes(); // get the bytes from String
// Create new Image
Image img2 = Image.createImage(imgData2, 0, imgData2.length);
[SHOW IMG2] // Showing img2 is not OK. The image gets degradated