save Image from ImageEditor

4 posts, 0 answers
  1. Salwa
    Salwa avatar
    1 posts
    Member since:
    Aug 2011

    Posted 23 Aug 2011 Link to this post

    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.
  2. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 26 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Bala
    Bala avatar
    20 posts
    Member since:
    Dec 2011

    Posted 09 Jun 2014 in reply to Ivailo Karamanolev Link to this post

    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
  5. Todor
    Admin
    Todor avatar
    168 posts

    Posted 11 Jun 2014 Link to this post

    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.
     
Back to Top