ResizeCommand

6 posts, 0 answers
  1. Peter
    Peter avatar
    9 posts
    Member since:
    Apr 2011

    Posted 21 Feb 2012 Link to this post

    I would like to resize the image to a specific size (so use the command instead of the tool). I have:

                Dim resize As New ResizeCommand
                Editor.ExecuteCommand(resize, Nothing)

    But instead of "Nothing" I need a context object. I assume I should send the desired height and width somehow but what object should I be sending?
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 24 Feb 2012 Link to this post

    Hello Peter,

    You will need to pass an instance of the ResizeCommandContext class. You can specify the new width and height of the image in the constructor of the context. Also there is no need to create a new instance of the command itself - you can use the statically create instances in the ImageCommands class.

    Here is a code example:

    Editor.ExecuteCommand(ImageCommands.Resize, New ResizeCommandContext(200, 200))

    Greetings,
    Alex
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 16 May 2013 Link to this post

    hi,

    i try to resize the image after crop command executed and reset.

     i put the command on the resetSettings() function of croptool.

     public void ResetSettings()
            {
                if (this.ReserveWidth > 0 || this.ReserveHeight > 0)
                {
     
                    this.imageEditor.ExecuteCommand(ImageCommands.Resize,new  ResizeCommandContext(ReserveWidth, ReserveHeight));
     
                }
     
                this.cropAdorner.CropRect = new Rect(
                    this.imageEditor.Image.Width * 0.1,
                    this.imageEditor.Image.Height * 0.1,
                    this.imageEditor.Image.Width * 0.8,
                    this.imageEditor.Image.Height * 0.8
                );
     
     
                this.ReserveWidth = 0;
                this.ReserveHeight = 0;
                this.cropSettings.Reset();
                this.isDirty = false;
            }



    But this throws exceptions.

     

    Could you help me to figure it out?

     

     

    my propose is that I want to implement a function like Photoshop that ,when you crop an image with desire width and height, you input width and height in the tool settings, then when you drag the crop rectangle, it is always keep the ratio.

     

    for example, you input width 468px and height 250px.

     

    you can drag the crop size to (468*n)  X (250*n), but finally you execute the change,

     

    The image will crop to the drag size and scale to reserved size.

  5. Boby
    Admin
    Boby avatar
    595 posts

    Posted 18 May 2013 Link to this post

    Hello Ye,
    We can continue the conversation in the support ticket we opened for you on the same matter.

    Kind regards,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Ye
    Ye avatar
    25 posts
    Member since:
    Aug 2012

    Posted 20 May 2013 Link to this post

    hello,

    i have used another account which is licensed user belongs to company.

    i reply your with another ticket.

    please connect this issue to that.
  7. Petya
    Admin
    Petya avatar
    975 posts

    Posted 21 May 2013 Link to this post

    Hello Ye,

    I answered the other thread you started and we can continue our communication there.
     
    All the best,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner