×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    23

    Maximum png image size

    Hi,

    If I download an image from the web, is it loaded into the heap memory? . So typically I would have about 150kb to play with.

    Is this correct anybody?

    Thanks Jim

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Are you talking about downloading into a browser, or into a Java application?

    Anything you download into a Java application must be stored in the heap. This is always true while the image is the downloaded byte-array, but once createImage() is used to render an image object from the datastream, some devices may store it in a separate image heap (though, this is unusual).

    If you're asking about maximum sizes for the browser, I think that this information (for Nokia devices) is in the browser characteristics document, available in the Forum Nokia site.

    Graham.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    Graham,

    Thankyou for your reply. I am downloading into a J2ME application. I have managed to download images upto 25kb in size and subsequently create an Image from the byte array. My problem now is to scroll across this image (the images typically are panoramic views with an aspect ratio of about 5:1, so you could say around 120bitsx600bits. The problem seems to be performance in repainting. As I understand it there are 2 ways that I could approach this.

    1. Download the png image as a byte array.
    Convert the complete byte array to an image
    Paint the image to the screen multiple times (while moving
    the x-anchor point).

    2. Download the png image as a byte array
    Create an image from a subset of the byte array
    Paint to the screen
    Create a new image from a different subset of the byte array
    Paint this to the screen, and so on.

    So far I have been unable to create a subset of the byte array (method 2), I'm not sure about the png format (headers etc) so suspect that unless you have the correct offset it does not work.

    Method 1. works on the emulators, some faster than others. But strangely does not seem to work on real phones. I am getting an exception when trying to download the png image. I am assuming that I simply use the "standard" http connection code (as published many times) and just aim it at the png file i.e http://www.chordfone.com/lroom.png or is there something special I have to do to download these files...... I wouldn't have thought so.

    Anyhow, thanks again for your reply, If you have any suggestions as to how to improve the repainting performance or as to why I seem to be having problems downloading png files to real phones I would be very pleased to hear back from you.


    Best Regards Jim

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Hi Jim,

    You're talking about *big* images. Some devices have problems with images bigger than the screen, others with images larger than 256 pixels in either direction. Also, 120x600 is going to cost 140k, plus the size of the PNG from which it's derived (you have to hold both in memory at the same time).

    I'd suggest you split the image into smaller ones before downloading.

    Cheers,
    Graham.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×