Hi.
I'm developing some image midlet.
But I don't know how to store images in Rms.
help me..
Hi.
I'm developing some image midlet.
But I don't know how to store images in Rms.
help me..
in Pure MIDP1 you can not, in MIDP 2 you can use the Image.getRGB( ... ) and save the int array, and on Nokia phones (but only nokia phones) you could use a getPixels( .. ) and again save the array.
Hi...,
How about reading it in the form of byte array and then storing it.
Regards
Chandu
You can use DirectGraphics to get the pixel byte array, and save the byte array to RMS. like this:
Image image = Image.createImage("foo.png");
DirectGraphics dg = DirectUtils.getDirectGraphics(Image.getGraphics());
byte[] b = new byte[image.getWidth(),image.getHeight()];
b = dg.getPixels(...);
and using RMS to store image.
It all depends on where your image comes from. If it's a PNG from a network resource or the jar, it can be read as an array of bytes in the first place, and there's no need to mess about. As Chandu said, you can just store it.
Even if you can grab an image in any other way, it's likely to be huge - getRGB() grabs an array of ints, that's 32 bits/pixel. If you're limited to 20k of RMS, that's not so many pixels.
Can you tell us more about where your images are from, and what device you're targeting?
Graham.
what package do i have to import if i will use the DirectGraphics class?
if the png file is in my network resource or jar, how can i read it as array bytes?
thanks so much in advance.