xamarin sfimageeditor qustion

After importing the image from the gallery, the imagesource is delivered to sfimageeditor to modify it, return it, and update it on the screen. After that, if the source is passed back to sfimageeditor, the image does not appear.


phtoload > imageeditor > sava > imageeditor

Attachment: App10_32eee649.zip

1 Reply 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team January 11, 2021 12:52 PM UTC

Hi Yanghongmin,

Greetings from Syncfusion.


We have analyzed the reported issue “Image doesn’t appear when loading” and we found that the reported problem occurs due to stream is disposed once it consumed to display the preview.

When loading the edited image, we will get the stream as below  
 
 


To resolve this problem, we have re-created the memory stream with existing stream bytes as per the code snippet.  
Device.BeginInvokeOnMainThread(()   =>  
            {  
                var buffer = new byte[16 * 1024];  
                byte[] byteArray;  
                using (MemoryStream ms = new MemoryStream())  
                {  
                    int read;  
                    while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)  
                    {  
                        ms.Write(buffer, 0, read);  
                    }  
                    byteArray = ms.ToArray();  
                }  
                Imagebox.Source = ImageSource.FromStream(() => new MemoryStream(byteArray));  
            });  
 

Please check the attached sample and let us know if you have any other concerns. The sample link is provided below:

Sample link:  https://www.syncfusion.com/downloads/support/forum/161279/ze/App10-1172449148

Regards,
Sridevi S.  
  
 


Marked as answer
Loader.
Up arrow icon