BTW: In my example the original byte count was 26489, then after instanciating an Image and then getBytes from new Image byte count changed to 26465 I'm not executing any scaling, so not sure why the diff after conversion.
On Friday, July 5, 2019 at 12:46:13 PM UTC-4, [email protected] wrote: > > If you are experiencing an issue please mention the full platform your > issue applies to: > IDE: NetBeans/Eclipse/IDEA Netbeans 8.2 > Desktop OS Windows 10 Pro > Simulator Latest > Device PC, Android, IOS > > My app shares Image data from a Database where Mobile Apps write to and > Java Swing apps write to. > > I am strugling to convert Image to bytes and back identically in Swing and > Mobile app. > > The App stores the Image in a "ImageViewer" component where the Swing app > in a Icon Label; > > General question is the approach to convert com.codename1.ui.Image to > bytes and bytes to com.codename1.ui.Image > > Currently I use: > Image CustomerPicture = Image.createImage(custPhotoBytes, 0, > custPhotoBytes.length); > byte[] imgBytes = > inc.getBytesFromImage(A3CustomerPhotoImageViewer.getImage()); > > 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 > > > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/4653db6d-0c17-42fa-b22d-472629a92aaa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
