×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    90

    Image Resizing in N91

    Do anyone have any idea of resizing of images in N91. The code is working fine in emulator. But in real phone it is throwing an uncaught exception.


    public Image createThumbnail(Image image) {
    int sourceWidth = image.getWidth();
    int sourceHeight = image.getHeight();

    // int thumbWidth = 64;
    int thumbWidth = 100;
    int thumbHeight = -1;

    if (thumbHeight == -1)
    thumbHeight = thumbWidth * sourceHeight / sourceWidth;

    Image thumb = Image.createImage(thumbWidth, thumbHeight);
    Graphics g = thumb.getGraphics();

    for (int y = 0; y < thumbHeight; y++) {
    for (int x = 0; x < thumbWidth; x++) {
    g.setClip(x, y, 1, 1);
    int dx = x * sourceWidth / thumbWidth;
    int dy = y * sourceHeight / thumbHeight;
    g.drawImage(image, x - dx, y - dy,
    Graphics.LEFT | Graphics.TOP);
    }
    }

    Image immutableThumb = Image.createImage(thumb);

    return immutableThumb;
    }

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Posts
    516

    Re: Image Resizing in N91

    Hi,

    What is the size (resolution) of the input image u r using. is it a very big image. It may cause problems.

    Please refer the following thread in Sonyericsson forum which may be helpful to u.
    http://developer.sonyericsson.com/th...D=77127&#77127

    Wang

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Image Resizing Issues..
    By mayankkedia in forum Symbian
    Replies: 0
    Last Post: 2006-02-15, 10:17
  3. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  4. MMS( resizing image)
    By Utk in forum General Messaging
    Replies: 1
    Last Post: 2005-01-01, 05:10

Posting Permissions

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