J2ME Memory Limitations for Images

Hi ...

I have a J2ME app which loads up an image, the user is then able to scroll around the image and edit it. However I have had big problems with larger images ( greater than 800 x 800 px ). This is down to memory limitations going by the error message on certain devices.

I am currently loading the image by putting it in a tiledLayer which works well for scrolling it neatly. So far the only thing I can think to get round the limitation is to slice the image in to smaller parts and load up a new tiledLayer when comming to the edge of the previous one.

Would this work or will the memory limit still be breached when spread over numerous tiledlayers ?

Perhaps there is a better way of doing this that I havent thought of ?

Many thanks for any suggestions ...

Chris

[815 byte] By [chris_j_pooka] at [2007-11-27 9:33:03]
# 1
blump ...
chris_j_pooka at 2007-7-12 22:53:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

It depends how you will load your image. If you just load it via Image.createImage(), it wouldn't change anything if you would split the picture onto several TiledLayers, because the image would be loaded as a whole into the memory and would take up more than 0,6 MB of space in memory. (Assuming a 800x800 picture. Depending on the device it can be even more than a Megabyte).

Is your image located within the jar-file or do you load from a webserver?

JoachimRohdea at 2007-7-12 22:53:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
Thanks for the reply ...Yes its in the JAR file. Are you sugesting I stream the file instead ?How would that be possible and still use the TiledLayer... Or would I need to implement my own tiling based on which section I was currently streaming ?
chris_j_pooka at 2007-7-12 22:53:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
It's not that trivial. You could cut the image into pieces on the server-side and just send the pieces to the client which is needed. But it is questionable if this method is fast enough and if the effort is worth the cost.Why do you need such a high resolution anyway?
JoachimRohdea at 2007-7-12 22:53:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

Hi,

They are large satalite map images. Each image comes as a 800x800px PNG file.

The problem I have is that even if I cut the image in to sections, say 320x270 ( the screen size, I think? ) I may still need to have 4 of these in memory at once if the screen is scroled like the picture below ( so I would be loading in just as much data as before ).

|

-

|||

|1 | 2|

|||

|||

|--|-

|||

|3|4|

|||

|||

-

|

Or do you mean I remake the Tiled layer on each move so that only the 320x270 pixels are in memory? I think I might have to ditch the TiledLayer if I do it like this ...

Message was edited by:

chris_j_pook

Message was edited by:

chris_j_pook

Message was edited by:

chris_j_pook

chris_j_pooka at 2007-7-12 22:53:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...