This is a migrated thread and some comments may be shown as answers.

save Image from ImageEditor

3 Answers 119 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Salwa
Top achievements
Rank 1
Salwa asked on 23 Aug 2011, 09:15 PM
I want to save image from ImagEditor in code behind to external file by my own save method, I read that I can use the "IImageFormatProvide" interface for this target.
I have written the following code :
IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
byte[] image = formatProvider.Export(this.ImageEditorUI.ImageEditor.Image);
I although tried to use the overload method: formatProvider.Export(this.ImageEditorUI.ImageEditor.Image,stream);
then I called my save method which take the byte array and save it in fileStream, but the Export method didn't work.
can you help me please.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 26 Aug 2011, 02:04 PM
Hello Salwa,

For reference, here's how the overload that returns byte[] is implemented:
using (MemoryStream stream = new MemoryStream())
{
    this.Export(image, stream);
    return stream.ToArray();
}
This means that the byte[] overload uses internally the Stream overload, so if the former works, the latter should too. If you are continuing to experience issues with the latter, can you give us some specific information as to what exactly doesn't work so we can assist you further?

Regards,
Ivailo
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Bala
Top achievements
Rank 1
answered on 09 Jun 2014, 07:01 AM
Hello Ivailo Karamanolev,

                 I need to upload the image after editing from RadImageEditorUI  to client bin path of server , what have to be done?

Regards,
MSB
0
Todor
Telerik team
answered on 11 Jun 2014, 11:28 AM
Hello Bala,

The Export() method of the IImageProvider you use to export the image from the RadImageEditor will return the byte array which you can use to upload the image on the server later.
For example, if you have an application with RadImageEditorUI in it, named "ImageEditorUI" and the image is with "png" extenstion, the following code block can be used to get the necessary byte[]:
PngFormatProvider provider = new PngFormatProvider();
byte[] bytes = provider.Export(this.ImageEditorUI.Image);

After you get the byte[], you can pass it to the appropriate service which will be responsible to upload the image on the server. You can read how to make such a service in this blog post.

More about Import/Export features of RadImageEditor, you can read in our very descriptive help article.

If you have further questions, please do not hesitate to contact us again.


Regards,
Todor
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ImageEditor
Asked by
Salwa
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Bala
Top achievements
Rank 1
Todor
Telerik team
Share this question
or