If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA Netbeans 8.2Desktop OS Windows 10 ProSimulator LatestDevice PC, Android, IOS
I am strugling to convert Image to bytes and back in my Mobile app.
General question is the approach to convert bytes to com.codename1.ui.Image and back
Currently I use:
custPhotoBytes.length = 26489
Image CustomerPicture = Image.createImage(custPhotoBytes, 0, custPhotoBytes.length);
inc.getBytesFromImage(CustomerPicture).length = 26471
byte[] imgBytes = inc.getBytesFromImage(A3CustomerPhotoImageViewer.getImage());
imgBytes .length = 26471
conversion dif of 18 bytes. Why?
public byte[] getBytesFromImage(com.codename1.ui.Image image) {
EncodedImage img = null;
try {
img = createFromImage(image, true);
} catch (Exception e) {
}
return img != null ? img.getImageData() : new byte[0];
}
Is there a better approach?
Thanks in advance.
Regards