locked
Convert Image to ByteArray RRS feed

  • Question

  • User226634 posted

    I have this image in xaml: <Image x:Name="imageEntry" HeightRequest="240" /> the image will be added after browsing an image from phone gallery. So, when i'll be saving data after clicking save button, I need to get the image and convert to byte array.

    async void OnSaveNoteButtonClicked(object sender, EventArgs args)
    {
         Image img = imageEntry;
         byte[] imgdata = **Need to convert to byte array--img
         var N_Note = noteEntry.Text;
    }
    

    Can someone advice me how to do it. Thank you.

    Thursday, May 17, 2018 10:23 AM

All replies

  • User88712 posted

    https://theconfuzedsourcecode.wordpress.com/2016/02/24/convert-android-bitmap-image-and-ios-uiimage-to-byte-array-in-xamarin/

    Thursday, May 17, 2018 10:33 AM
  • User226634 posted

    @SirAndriy is there no other way than converting image to Bitmap?

    Thursday, May 17, 2018 12:38 PM
  • User89714 posted

    @JenalynParagados - This question has been asked many times on the forums. Skim through the search results at https://forums.xamarin.com/search?Search=image+to+byte+array

    Thursday, May 17, 2018 12:57 PM