How to convert image to byte array in J2ME ??
A:
- Did you try toString? (don't know if that works, just guessing)
- You can call getRGB in loop to get all the pixel values.
hlynur
2010-08-09 04:56:46
Neither of these work in J2ME.
funkybro
2010-08-09 09:59:05
Neither of these work for mee too.
success_anil
2010-08-09 10:48:10
Written following code for getting byte [] out of image ..byte[] capturedImageData = imageOnScreen.toString().getBytes();Is it right ?
success_anil
2010-08-09 10:55:48
+1
A:
You can't get the original (probably compressed) image back. But you can use [Image.getRGB()][1] to retrieve the RGB data; this can then be stored somewhere, and the image reconstructed later. This will take up more space than the original .png (or whatever format it was); you'll need to compress it yourself if that is unacceptable.
[1]: http://download-llnw.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/javax/microedition/lcdui/Image.html#getRGB(int[], int, int, int, int, int, int)
funkybro
2010-08-09 10:00:50
A:
Use this function getRGB, it will return the byte array!
getRGB(rgbs, 0, image.getWidth() , 0, 0, image.getWidth(), image.getHeight());
Azlam
2010-08-19 18:01:32