Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2007
    jakarta, indonesia

    image processing-splitting&resizing

    hi all,
    i'd like to know a technique or two to process image(resizing) a big-size image (1600x1200pix)
    i'm thinking bout splitting up the image into 4 pieces and then processing each one at a time.

    i've tried this code to duplicate :
    public static Image duplicateImage(Image old, int x, int y)
    Image duplicate = null;
    Graphics _g = null;
    dup = Image.createImage(old.getWidth()/2,
    _g = dup.getGraphics();
    _g.drawImage(old, x, y, Graphics.TOP | Graphics.LEFT);
    return duplicate;

    and then in the paint function i write this :
    Image temp, temp1, temp2, temp3;
    temp = duplicateImage(this.image, 0, 0);
    temp1 = duplicateImage(this.image, this.image.getWidth()/2, 0);
    temp2 = duplicateImage(this.image, 0, this.image.getHeight()/2);
    temp3 = duplicateImage(this.image, this.image.getWidth()/2, this.image.getHeight()/2);

    when i do the drawing of the 4 duplicated-and-processed image
    g.drawImage(temp, Definition.phoneWidth/2, Definition.phoneHeight/2, Graphics.BOTTOM|Graphics.RIGHT);
    g.drawImage(temp1, Definition.phoneWidth/2, Definition.phoneHeight/2, Graphics.BOTTOM|Graphics.LEFT);
    g.drawImage(temp2, Definition.phoneWidth/2, Definition.phoneHeight/2, Graphics.TOP|Graphics.RIGHT);
    g.drawImage(temp3, Definition.phoneWidth/2, Definition.phoneHeight/2, Graphics.TOP|Graphics.LEFT);

    the problem i'd like to ask is..
    why is it that i can only draw the duplicated image for the first time only? (1/4 of the first image-temp- only got drawn, the rest 3x 1/4 image only appers to be white..)

    then i try to split and duplicate the original image into 1/2 only. guess what, it's just the same. the only image got drawn is the first 1/2 part of the original image(top one) while the bottom 1/2 part just went white...


  2. #2
    Super Contributor
    Join Date
    Mar 2005

    Re: image processing-splitting&resizing

    your drawImage in the duplicate should be :

    _g.drawImage(old, -x, -y, Graphics.TOP | Graphics.LEFT);


  3. #3
    Registered User
    Join Date
    May 2007
    jakarta, indonesia

    Re: image processing-splitting&resizing

    still no success handling large image( 2 megapixel = 1600x1200 )
    anybody know other way to do so ?

    i'm looking for another way to read the (large)image file from internal phone memory,anybody have a clue?
    i'm currently using this method :

    fileConnection = (FileConnection)Connector.open(fileToOpen, Connector.READ);
    //note fileToOpen is string contains "file:////....."
    if(fileConnection.exists() && fileConnection.canRead())
    file = fileConnection.openInputStream();
    this.image = Image.createImage(file);

    i'm afraid my phone's memory(and also most phones i suppose) dont have much memory to load the image.
    i'm thinking about a way to read it byte by byte / stream by stream. and then process it partially. until finish.


Similar Threads

  1. Python build problem
    By Santehnik.UA in forum Symbian
    Replies: 7
    Last Post: 2008-07-21, 07:34
  2. [Pys60, 3rd Ed.] build problems
    By MHOOO in forum Symbian
    Replies: 3
    Last Post: 2007-04-09, 19:00
  3. SIS fails
    By chirag_cel in forum Symbian
    Replies: 8
    Last Post: 2006-11-29, 10:06
  4. 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
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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