Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jul 2009

    convert string into image

    byte imageData[];
    String filestring= imageData.toString();
    When I print filestring it prints value like this "[B@d590dbc". Can this value be converted back into image?

    Or can I convert string of ByteArrayOutputStream into image?

    How do I do that?


  2. #2
    Registered User
    Join Date
    Oct 2009

    Re: convert string into image

    You cannot convert the string data back to image like this, neither ByteArrayOutputStream will help.
    If the purpose is to transfer this image over internet or store in file system for later use... try to convert it in to PNG format like this --- http://wiki.forum.nokia.com/index.ph...ing_in_Java_ME

    and then send it over to the other end, when you can again use createImage() to get it back.

    Or use Image.getRGB() to get a Int array from the image object and then use Image.createRGBImage(int[] rgb, int width, int height, boolean processAlpha) to recreate it.

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK

    Re: convert string into image

    If you're looking for a textual representation of a byte[] (that could be transmitted by email, for example), then you'd need to implement a BASE64 encoder and decoder. Google will find you the specification for this format.

    If you want to understand what "[B@d590dbc" means, then read the specification for Object.toString() in the JavaDocs. It is not a representation of the entire object..


Similar Threads

  1. Convert string to hexadecimal value ?
    By amar_wagholikar in forum Symbian
    Replies: 3
    Last Post: 2009-12-03, 14:20
  2. Convert String into Hex
    By cashgoh in forum Symbian
    Replies: 3
    Last Post: 2008-08-28, 08:30
  3. How to convert UTF8 string to WCHAR string.
    By varungu in forum Open C/C++
    Replies: 1
    Last Post: 2008-01-31, 12:36
  4. convert to string
    By pmdr05 in forum Symbian
    Replies: 4
    Last Post: 2007-02-09, 07:15
  5. convert to string
    By pmdr05 in forum Mobile Java General
    Replies: 3
    Last Post: 2007-02-08, 21:32

Posting Permissions

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