Return edited file from image editor

1 Answer 110 Views
ImageEditor
Rolf
Top achievements
Rank 1
Iron
Iron
Iron
Rolf asked on 16 Apr 2023, 03:13 PM
After editing an image with the ImageEditor, I want to save the result. How can I get the result as a binary array?

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 18 Apr 2023, 07:13 AM

Hi Rolf,

The saving options image editor control provides are described here: https://docs.telerik.com/devtools/maui/controls/imageeditor/saving-image the output stream is of type Stream. If you want to save the image as a byte array, than you have to convert the stream to a byte array. I have found the following links that could be of help: 
https://stackoverflow.com/questions/221925/creating-a-byte-array-from-a-stream 

https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream.toarray?view=net-6.0 

https://learn.microsoft.com/en-us/dotnet/api/system.io.stream.read?view=net-7.0

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Rolf
Top achievements
Rank 1
Iron
Iron
Iron
commented on 19 Apr 2023, 01:59 PM

Thanks Didi for the support. Now it works fine. But there is now another question. After saving the edited image to a ftp server  I want to load it again. But I get the original version. Is there something of caching? How can I avoid caching?
Didi
Telerik team
commented on 19 Apr 2023, 03:01 PM

Hi Rolf, 

If you get the updated image from the server and pass it to the editor, the ImageEditor will load this image. I cannot say why the original image is loaded. You can add Image control and ImageEditor control and pass the same image to both controls to test what will be the result. If both controls displays same image, then you pass the wrong file. 

If the issue only occurs in the ImageEditor, then I will need a repro project to research the case in details. If you do not want to send the project to the forum, you can open a support ticket and attach it there.

Tags
ImageEditor
Asked by
Rolf
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Didi
Telerik team
Share this question
or