×

Discussion Board

Results 1 to 6 of 6

Thread: Image Capture

  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    Image Capture

    Is there any way to reduce the byte[] size in which the camera captured image is stored im encoding the byte array in to base64 binary and trying to send it to server.

    or else can anyone suggest an alternative to send image to the server

  2. #2
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    Re: Image Capture

    anyone can suggest how to send image to server successfully

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Ahmedabad
    Posts
    254

    Re: Image Capture

    Hi,

    Base64 alogrithm is more of a encoding rather than compression. Base64 makes sure that there is no loss of data in between.

    If you want to reduce the size of images while transferring then one way is to reduce the resolution of the images captured that will automatically reduce the size of the images. Otherwise you may have to implement image compression algorithms such as Run length encoding or Huffman Coding.

    In implementing the image compression algorithms make sure that the time taken by the algorithm should not be much otherwise it will be of no use I think.

    Hope this information will help you.
    Sunil
    Mobile Application Developer

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Image Capture

    Hi Mahesh,
    Following the suni post you can move forward with the code,
    FileConnection fc = (FileConnection) Connector.open(”file://localhost/root1/path/to/file”);
    if (!fc.exists())
    {
    throw new IOException(”File does not exists”);
    }
    InputStream fis = fc.openInputStream();

    byte[] b = new byte[5000];
    int length2 = fis.read(b, 0, 5000);

    fis.close();
    fc.close();

    Now to avoid lose of data, we can apply base64 encoding like

    String tempStr2 = new String(Base64.encode(fileBytes));

    Note:- you may useany base64 class for this use but encoding and decoding should be synchronized no matter whatever is implementation technology on server

    * Now we will build http connection and upload data on it

    httpConnection = (HttpConnection) Connector.open(”http://Server/Address/to/target/script”);
    httpConnection.setRequestMethod(HttpConnection.POST);
    httpConnection.setRequestProperty(”User-Agent”, “Profile/MIDP-2.0 Configuration/CLDC-1.0″);
    httpConnection.setRequestProperty(”Content-Language”, “en-US”);
    httpConnection.setRequestProperty(”Content-Type”, “application/x-www-form-urlencoded”);
    httpConnection.setRequestProperty(”Content-Length”, Integer.toString(data.length));

    os = httpConnection.openOutputStream ();
    os.write(data);
    os.close();
    httpConnection.close();

    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    Re: Image Capture

    Hi raj

    i tried the same http code but might some prblm in compatibility as our web service is written in .net also tried encoding the image in base 64 binary but in .net the decoded string is not exactly what we wanted

    thnks

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Image Capture

    Hi Mahesh,
    Please discuss the same issue with your server side team,Check wjat they can do for you,in order to solve this issue,
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Fast Image Capture
    By Tobias_80 in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2007-06-18, 12:29
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. how can i capture image with a background image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-01-23, 16:35
  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
  •