×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    139

    Image.createImage returns a clipped image

    Hi everybody,

    I'm developing a J2ME application that should get a snapshot from the camera and show it to the user. I initialized the camera as follows

    Code:
    p = Manager.createPlayer("capture://video");
    p.realize();
    
    // Grab the video control and set it to the current display.
    vc = (VideoControl)p.getControl("VideoControl");
    if (vc != null) {
       videoForm.append((Item)vc.initDisplayMode(vc.USE_GUI_PRIMITIVE, null));
                        getDisplay().setCurrent(videoForm);
    }
    
    p.start();
    and get an image by calling

    Code:
    imageData = vc.getSnapshot(null);
    The problem is that when i create a Image object and show it on a form or a splashscreen i have clipped image. If I use a Form and append the image to it, the left part of the picture is shown. If i use a splashscreen it shows the central part. But never the whole image.
    What I do is

    Code:
    snapShot = Image.createImage(imageData, 0, imageData.length);
                        
    getSplashScreen().setImage(snapShot);
    getDisplay().setCurrent(getSplashScreen());
    I'm using a Nokia N73.

    Anybody got a clue?

    Thanks in advance

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Image.createImage returns a clipped image

    From the problem description, it seems to be a problem of clipping: maybe the image is simply too big to fit within the screen size, or you're setting clipping regions too small for the image itself.

    Pit

  3. #3
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    139

    Re: Image.createImage returns a clipped image

    The fact is that if i dump the image byte array on a file i get the well-dimensioned image. How can i resize the image then?

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Image.createImage returns a clipped image

    You can find many examples of image resizing in J2ME around, like this:

    http://miniim.blogspot.com/2008/05/i...d-way-for.html

    Pit

  5. #5
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    139

    Re: Image.createImage returns a clipped image

    Thank you Jappit, your tips were very useful

    Bye

Similar Threads

  1. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  2. Drawing Lines on an Image (image graphics object returns null)
    By nicenouman in forum Mobile Java General
    Replies: 4
    Last Post: 2006-09-21, 10:15
  3. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  4. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31
  5. Personal
    By JSmith77 in forum PersonalJava
    Replies: 4
    Last Post: 2003-07-30, 12:52

Posting Permissions

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