Image Orientation Issue: RadImageEditorUI

2 posts, 0 answers
  1. em
    em avatar
    2 posts
    Member since:
    Jun 2017

    Posted 30 Jun Link to this post

    The image I'm working on has some metadata because of which the landscape photo is displayed portrayed. User can rotate once loaded, but what I'm trying to achieve is load the image with proper orientation in first place. I have tested my C# code to read the metadata orientation of image and correct it accordingly to load it properly in normal WPF image control. But I'm having problem using the same code in the Telerik RadImageEditorUI. Basically, I'm looking for an event that could be raised when user selects open>select image from radImageEditorUI dialog box, which then I can use to handle the orientation handling code. 

    So, my question is, is there something in Telerik RadImageEditorUI that can handle the orientation issue when loading image? or Is there some kind of image loading or image selected event raised?

        

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    603 posts

    Posted 05 Jul Link to this post

    Hello em,

    To achieve the desired result, you can handle the CommandExecuted event of the RadImageEditor and rotate the image if the command is of type OpenImageCommand. Here's what I have in mind:

    private void ImageEditorUI_ImageEditorLoaded(object sender, EventArgs e)
    {
        var editorUi = sender as RadImageEditorUI;
        editorUi.ImageEditor.CommandExecuted += ImageEditor_CommandExecuted;
    }
     
    private void ImageEditor_CommandExecuted(object sender, Telerik.Windows.Media.Imaging.ImageEditorCommands.ImageCommandExecutedEventArgs e)
    {
        var editor = sender as RadImageEditor;
        if (e.Command is OpenImageCommand)
        {
            editor.Rotate(90);
        }
    }

    Please let me know whether such an approach would work for you.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top