locked
iphone send 64bit data to WCF RRS feed

  • Question

  • User-171003712 posted

    iphone send 64bit string converted to images then send to wcf rest full web service so can any body tell me how i get this and how to convert into images i mean i have simply create a restful webservice and get some info from iphone but there is problem is image Iphone developer want to send image in formatted of 64bit string. but i have no idea to how i handle to my rest full web-service i any body have a sample of code so tell me and how i get this data and how to convert to 64bit image in to i have no idea thanks

    Saturday, August 10, 2013 12:39 PM

Answers

  • User220959680 posted

    how i get this and how to convert into images

    C# How to: Decoding/Converting Base64 strings to Bitmap images

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 12, 2013 5:41 AM
  • User260886948 posted

    Hi,

    For convert the 64bit string to images, here is an example, you can modify the method to accept a string parameter.  Then just save the image object with .Save():

     public Image LoadImage()
        {
            //get a temp image from bytes, instead of loading from disk
            //data:image/gif;base64,
            //this image is a single pixel (black)
            byte[] bytes = Convert.FromBase64String("R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==");
    
            Image image;
            using (MemoryStream ms = new MemoryStream(bytes))
            {
                image = Image.FromStream(ms);
            }
    
            return image;
        }

    Best Regards,
    Amy Peng

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 13, 2013 9:50 PM

All replies

  • User220959680 posted

    how i get this and how to convert into images

    C# How to: Decoding/Converting Base64 strings to Bitmap images

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 12, 2013 5:41 AM
  • User260886948 posted

    Hi,

    For convert the 64bit string to images, here is an example, you can modify the method to accept a string parameter.  Then just save the image object with .Save():

     public Image LoadImage()
        {
            //get a temp image from bytes, instead of loading from disk
            //data:image/gif;base64,
            //this image is a single pixel (black)
            byte[] bytes = Convert.FromBase64String("R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==");
    
            Image image;
            using (MemoryStream ms = new MemoryStream(bytes))
            {
                image = Image.FromStream(ms);
            }
    
            return image;
        }

    Best Regards,
    Amy Peng

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 13, 2013 9:50 PM