Results 1 to 1 of 1

Thread: Rebuild image

  1. #1
    afflictedd2 is offline Member
    Join Date
    Apr 2009
    Posts
    5
    Rep Power
    0

    Default Rebuild image

    Hi everyone,

    I'm sending an image from a midlet via http, but I'm not sure how to rebuild the image from this data and save it as PNG somewhere in the web application? Anyone know of a good simple example for this?

    DataOutputStream dos = conn.openDataOutputStream();

    int height, width;

    // Calculate needed size and allocate buffer area
    height = image.getHeight();
    width = image.getWidth();
    int[] imgRgbData = new int[width * height];
    image.getRGB(imgRgbData, 0, width, 0, 0, width, height);
    dos.writeInt(width);
    dos.writeInt(height);
    dos.writeLong(System.currentTimeMillis());
    dos.writeInt(imgRgbData.length);
    // Serialize the image raw data
    for (int i = 0; i < imgRgbData.length; i++) {
    dos.writeInt(imgRgbData[i]);
    System.out.println(imgRgbData[i]);
    }
    Last edited by afflictedd2; 04-13-2009 at 12:48 AM.

Similar Threads

  1. Replies: 14
    Last Post: 04-10-2009, 08:46 AM
  2. How to get image
    By zifis in forum New To Java
    Replies: 4
    Last Post: 03-26-2009, 05:24 PM
  3. Canvas Image popups another image (SWT)
    By SpaceY in forum New To Java
    Replies: 2
    Last Post: 11-11-2008, 01:25 PM
  4. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 06:17 PM
  5. Replies: 0
    Last Post: 01-08-2008, 05:29 PM

Posting Permissions

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