×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    24

    How to Convert Binary Data(sent in XML file) to an image file

    Hiiiii

    I want to know that How to convert the binary Data to an image file .

    A. NET server is converting the image file to binary data and sending it through XML file.
    I need to receive it thru HTTP Post and convert it to the image file .(Mine one is Symbian app).

    Plz help mw eout
    I hav ebeen stucked

    Thanx

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to Convert Binary Data(sent in XML file) to an image file

    have a look at CImageDecoder (2nd platform) it should help you to convert the image buffer to a bitmap image.

    If you want to do a file, then in case the binary string is already in some format, then just save it to a file and it should work.

    Anyway, in both cases remember to check if the binary data is encoded (for example using base64) somehow, and if it is, you need to decode it before processing it.

    yucca

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    24

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Thank you

    But CImageBufferedDecoder or CImageEncoder/CImageDecoder ,these APIs converts to.from bitmap format.

    But I need to convert either from binary data or from base64 encoded dat

    I am giving the data(for both binary and base64encoded encoded) of an image

    Byte:xFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    Base64encoded value: U3lzdGVtLkJ5dGVbXQ==

    Waiting for your help
    Thank You

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to Convert Binary Data(sent in XML file) to an image file

    in case you are getting it with Base64, then you need to decode the base64 first (answers for doing this should be available on this forum already also). either way you end up with binary data that is your image, and the format depends on your servers logic. So in case it is one of the recognized formats by the phone, you can use this binary data directly by saving it to a file, or if you want to show it on the screen, then use it as a descriptor buffer input for the image converters.

    yucca

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    24

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Hi
    I tried it by saving the byte code directly to both in .jpg file and .txt file, after that i used CImageDecoder to decode it to bmp but it showed me error.
    What should I do ?
    Thank u

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    10

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Hi,

    I tried to decode the base64 encoded image using symbian base64 class, the same code works for text data but for this image data it gives an empty destination buffer.

    Any clues?

    S.

  7. #7
    Registered User
    Join Date
    Jun 2007
    Posts
    6

    Angry Re: How to Convert Binary Data(sent in XML file) to an image file

    hello friends,

    i am having the same problem but that is in text, i have connected my mobile to software for recieving and sending sms and it is saving the english sms in text but hindi sms in Binary Form like Binary=1;DCS=8;Data=0915093E091A091F, how i will decode this back in hindi, someone please tell me. it's urgent

    Regards

    Simranjit Singh

  8. #8
    Registered User
    Join Date
    May 2008
    Posts
    179

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Quote Originally Posted by symbianyucca View Post
    in case you are getting it with Base64, then you need to decode the base64 first (answers for doing this should be available on this forum already also). either way you end up with binary data that is your image, and the format depends on your servers logic. So in case it is one of the recognized formats by the phone, you can use this binary data directly by saving it to a file, or if you want to show it on the screen, then use it as a descriptor buffer input for the image converters.

    yucca
    hi man,

    i have an Image recieved from web services with Base64 format and i need to convert or decode it to binary data that i can save it as jpg format or use CImageDecoder to convert it to mbm, but i can't fine the the API that i have to use to convert from Base64 to binary data, have you any information where i can find the solution ?

    thanks

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Where did you search from, I would recommend next time checking out our wiki: http://wiki.forum.nokia.com/index.ph...g_and_Decoding

  10. #10
    Registered User
    Join Date
    May 2008
    Posts
    179

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Quote Originally Posted by symbianyucca View Post
    Where did you search from, I would recommend next time checking out our wiki: http://wiki.forum.nokia.com/index.ph...g_and_Decoding
    many thanks to you man

  11. #11
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Hi,

    This might be very old query but still am not getting the solution. I have the same problem.

    I am getting the hexa data from the XML file :--

    data:-- like this
    <photo>/9j/4AAQSkZJRgABAAEAlgCWAAD//gAfCAkKCwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQo60XCxF5ZJ4xVCGSRkdaBieWCvSgREibTntTY2J60WER3A70WGVwMZixdW/GgZNZ9fxpjF1D7y/hSYwm/49VqWMr23U1LEypd/fH1qQNe3/48PwNSxmEPv1myjSg/1dQxiHqakYq00A6mB//Z</Photo>

    and after convert using base 64 decoding(by using following link http://www.developer.nokia.com/Commu...g_and_Decoding ) i am getting:--

    è’Çn Ësõ  NÔ
    @A#–éÀ¦G
    1 I=¨”×<S¹^ÛN$?sþïøÓØM›'“H“Å € ƒƒHbæ % €@ @ @ GÚ˜‚€€(ݨ(A  €`/Z (Gj x&€44ÍVãNŸÌð?‰OFúÕ'ÜG¡húݶ¥îßl€e£n£ühhWO¸SÉ=*FoÙÀùAÇÖ€,4‡&˜¯¯môø×2l^écè4€áõ¿O©“~êØuosþ_°„ç­HM % Z Bh
    ¥ .h†
    )^ô P0 BPPZb@(hë@ Š p )€´€^ÔÀ( (ËÞ€;Sþšî—Ñf_›±ÅTDzL_ññÐÿ *–2eû¬) ó÷ GT„y߉]ßV”;³m9Å7°ÌFêj J'z­ ½ 2@ ! bP!Ã¥!‹@ ) ÐPÿÙ


    But it would be like:------
    ÿØÿà
    starting from this i guess. I get this this my decode through one of the website but not getting from the symbian code. How do i decode the data like this. Any suggestions please.


    Thanks,
    Last edited by SecondInnings; 2011-08-18 at 10:09.

  12. #12
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Any suggestions please

  13. #13
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to Convert Binary Data(sent in XML file) to an image file

    if the base64 decoding does not give you right data, then do check what actully happens on the sending side.

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: How to Convert Binary Data(sent in XML file) to an image file

    http://www.motobit.com/util/base64-decoder-encoder.asp suggests that your data is correct ("ÿØÿà�JFIF�"... from that JFIF header I guess it is a JPEG file).
    Make absolutely sure that you really decode the /9j/4A... string, without the <photo> tag, or any extra garbage.

  15. #15
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: How to Convert Binary Data(sent in XML file) to an image file

    Thanks for the reply.

    Exactly thats i m saying data is correct.

    If i decode it through the website it give me correct data. But if i use the symbian function....

    as:-
    void CXmlHandler:oBase64Encoding(const TDesC8& aSourceData, TDes8& aEncodedData)
    {
    TImCodecB64 b64enc;
    b64enc.Initialise();
    b64enc.Decode(aSourceData,aEncodedData);
    }

    it gives different data which is not supported for jpeg. Is there any issue in the function or something wrong thing i m doing??

    Thanks,
    Last edited by SecondInnings; 2011-08-18 at 12:04.

Similar Threads

  1. create image file?
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 7
    Last Post: 2005-12-16, 01:37
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. Loading Image data from 'raw' bytes
    By LongSteve in forum Mobile Java General
    Replies: 2
    Last Post: 2002-11-20, 17:38
  4. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

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