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

ResizeCommand

5 Answers 57 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 21 Feb 2012, 09:42 PM
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?

5 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 24 Feb 2012, 09:55 AM
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 >>
0
Ye
Top achievements
Rank 1
answered on 16 May 2013, 02:50 PM

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.

0
Boby
Telerik team
answered on 18 May 2013, 03:37 PM
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.

0
Ye
Top achievements
Rank 1
answered on 20 May 2013, 07:36 AM
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.
0
Petya
Telerik team
answered on 21 May 2013, 09:09 AM
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.

Tags
ImageEditor
Asked by
Peter
Top achievements
Rank 1
Answers by
Alex
Telerik team
Ye
Top achievements
Rank 1
Boby
Telerik team
Petya
Telerik team
Share this question
or