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
Simulator Latest
Device PS, Android, IOS

Can you please provide complete code listing where we get bytes from Image 
(which I store in DB)
The convert those bytes to Image

I have these methods:
    public byte[] getBytesFromImage(com.codename1.ui.Image image) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        byte[] BytesFromImage = new byte[0];
        try {
            if (image != null) {
                ImageIO.getImageIO().save(image, outputStream, 
ImageIO.FORMAT_PNG, 1f);
                BytesFromImage = outputStream.toByteArray();
            }
        } catch (Exception e) {
            e.printStackTrace();
            MyLog.e(e);
        }
        return BytesFromImage;
    }


    public Image getImageFromBytes(byte[] img) {
        Image image = null;
        try {
            int width = 978;
            int height = 550;
            image = Image.createImage(img, 0, img.length);
            if (image.getHeight() > height || image.getWidth() > width) {
                image = image.scaled(height, width);
            }
        } catch (Exception e) {
            e.printStackTrace();
            MyLog.e(e);
        }
        return image;
    }


java.lang.IllegalArgumentException: Width (-35) and height (-20) cannot be 
<= 0
 at 
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
 at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
 at 
com.codename1.impl.javase.JavaSEPort.createTrackableBufferedImage(JavaSEPort.java:5081)
 at 
com.codename1.impl.javase.JavaSEPort.createTrackableBufferedImage(JavaSEPort.java:5064)
 at com.codename1.impl.javase.JavaSEPort.createImage(JavaSEPort.java:5089)
 at com.codename1.impl.javase.JavaSEPort.scale(JavaSEPort.java:5277)
 at com.codename1.ui.Image.scale(Image.java:1021)
 at com.codename1.ui.Image.scaledImpl(Image.java:967)
 at com.codename1.ui.Image.scaled(Image.java:932)
 at com.codename1.ui.Image.scaledSmallerRatio(Image.java:898)
 at 
com.codename1.components.SignatureComponent.setSignatureImage(SignatureComponent.java:261)


Please Advise:

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 codenameone-discussions+unsubscr...@googlegroups.com.
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/1b8f0ff7-e9fd-4e85-a40a-805676714d0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to