Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    5

    How image will display in different devices...

    Hi,
    I'm a beginner in the field of mobile development. I've just completed a canvas example with image. While doing that, i came across a question that how the image will look on different screen size / resolution on different devices (Sony, Nokia etc.).

    Let's say if i have loaded an image which is 240 x 320, what will happen if i see the same on a screen size of 128 x 160 or 360 x 640.

    Pls. spare some time and reply to this post. Because of this my work has got stuck ...

    Regards,
    Jatin

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How image will display in different devices...

    If, for example, the image is 200x200 pixels, then it will appear less than the screen size on a 240x320 screen. It will be greater than the screen size (so you will only see part of the image) on a 128x160 screen. It will occupy only a small part of a 360x640 screen.

    Does that make sense?

    Graham.

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    5

    Re: How image will display in different devices...

    Hi Graham,

    Thnx for the reply. Actually the problem is that i need to load an image onto a canvas and it should appear properly on different devices with different screen size. Lets say i am loading a background image and i want it to appear as per screen size no matter what the screen size is.

    Could you pls. guide me how to achieve such result? Otherwise for each device, i will have to create separate .jar file to show the image size perfectly fitted in the screen.

    Regards,
    Jatin

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

    Re: How image will display in different devices...

    Ultimately, you will need to match the sizes of images to the size of the screen.

    Your options are:

    1. Have different JARs for different image sizes. Obviously, you might need a lot of JARs! This is the popular approach for game developers.

    2. Have all the different sizes of image in one JAR. Unless you only have a very small number of images, this is likely to result in a JAR that is too big - many devices have a limit to the size of JAR they can install.

    3. Re-scale the images at run-time. There is no API method for doing this, so you'd need to write your own image scaling code. In general, the results are not likely to look very good.

    4. Use vector images using the SVG API, which will re-scale quite nicely. However, not all device support the SVG API. Also, SVG might not be suitable for your artwork style.

    For options (1) and (2), you need to be careful not to need images that match the screen size exactly. There is a huge number of screen sizes (once you look across manufacturers), some of which vary only slightly. For example, if you look at Canvas sizes (with setFullScreenMode(true)), there are Nokias with 176x208, Sony Ericssons with 176x220, and Motorolas with 176x204 or 176x205. That's just three manufacturers, all with the same screen width, but with four heights. Ideally, you want to use the same artwork on all these sizes. You need to consider that in designing your screen layouts. As I said, try to avoid needing images of exactly the screen size. Design the layout so it can cope with slight variations - for example, by painting a solid colour on the screen and centering an image on top.

    Graham.

  5. #5
    Registered User
    Join Date
    Nov 2009
    Posts
    5

    Re: How image will display in different devices...

    Hi Graham,
    Thnx a million for your support. I think now i have a better idea about how different devices deal with images and what not to do to ruin the look and feel of the application .

    Regards,
    Jatin

  6. #6
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    59

    Re: How image will display in different devices...

    Quote Originally Posted by grahamhughes View Post
    1. Have different JARs for different image sizes. Obviously, you might need a lot of JARs! This is the popular approach for game developers.
    Wow, this is the most popular approach ? How do game developers distribute a game this way ? Don't they end up creating a JAR for almost each phone model ?

    jatin.kanand i'm using Graham's 3rd option. You can find some resizing methods on google.
    Last edited by Infernal01; 2009-12-02 at 14:26.

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

    Re: How image will display in different devices...

    Quote Originally Posted by Infernal01 View Post
    Wow, this is the most popular approach ? How do game developers distribute a game this way ? Don't they end up creating a JAR for almost each phone model ?
    Any game from EA, Gameloft, Glu, Digital Chocolate, I-play, etc, will be constructed like this. Yes, they will have a large number of different JARs, just for one title. Not one for each model... Nokias, for example, support only 96x65, 128x128, 128x160, 176x208, 208x208, 240x320, 352x416 and 360x640. Eight sizes, even if you support every single one. And many of these are the same as, or sufficiently similar to, the sizes used by other manufacturers. (Oh, some of them work in both orientations, so you get 320x240 as well as 240x320 on the same device.) As I mentioned earlier, you'll use the same size artwork on screens that differ only slightly in size.

    Add to that, differences in sound capabilities, heap sizes, JAR restrictions, performance, API availability and quality, and so on, and you can end up with a large number of distinct JARs for a global release of one title (say, 50 to 100).

    Graham.

  8. #8
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    59

    Re: How image will display in different devices...

    I didn't knew that, thanks.

  9. #9
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    53

    Re: How image will display in different devices...

    I agree with Graham's suggestions. And also, for image scaling operations the developer can use JSR 226: Scalable 2D Vector Graphics API on the devices it support.

Similar Threads

  1. How to display image from resources?
    By Juggle4Evr1 in forum Symbian User Interface
    Replies: 21
    Last Post: 2010-12-28, 18:28
  2. problem in display an image button on canvas(Background image)
    By mramin05 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2008-11-12, 05:51
  3. Display, modify and save image
    By mazi888 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-03-13, 21:14
  4. Display an image in tabs
    By srouil in forum Symbian
    Replies: 2
    Last Post: 2006-03-02, 15:41
  5. I want to Display an image as part of installation
    By johnward1978 in forum Symbian
    Replies: 1
    Last Post: 2004-10-19, 04:02

Posting Permissions

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