Crop Static Height Width

2 posts, 0 answers
  1. mehmet
    mehmet avatar
    6 posts
    Member since:
    Jul 2011

    Posted 10 Jun 2014 Link to this post

    Hello everyone ,
    I have used a RadImageEditorButton as

     <telerik:RadImageEditorButton Grid.Column="2" Image="/Telerik.Windows.Controls.ImageEditor;Component/Images/Default/Crop.png"  
                                                      x:Name="btnCrop" Command="{Binding Path=Commands.ExecuteTool, ElementName=imageEditor}">

    I want to crop only assigned width and height like 320 x 220 and unresizeable.

    Thanks in advance..
  2. Todor
    Todor avatar
    168 posts

    Posted 13 Jun 2014 Link to this post

    Hi Mehmet,

    Thank you for contacting us.

    In case you want to execute the CropCommand with predefined start point, width and height values, you can use the following code snippet, placed in appropriate place into your code:
    CropCommandContext context = new CropCommandContext(100, 100, 320, 220);
    this.ImageEditorUI.ImageEditor.ExecuteCommand(new CropCommand(), context);
    Note that "ImageEditorUI" is the name of the RadImageEditorUI control which is used in the application. The code above will crop the image to an image with width '320' and height '220', starting from the point with coordinates (100,100) calculated from the image's top left corner.

    In case you want to make a custom tool, with different UI, you can go to our SDK Browser and see the CustomWatermarkTool demo or go directly to our GitHub repository, download and run the demo.

    If you have further questions, please get back to us.

    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