Sometimes we need to make our images smaller (or bigger), so they are more convenient to use. RadImageEditor ships with a Resize tool that allows the users to easily change the width and height of an image by setting custom dimensions, using predefined ones, or using a percentage of the original image. The tool can be shown on the ToolBar by creating a ImageEditorTool with CommandName="Resize".
The image can be resized programmatically on the client by using the RadImageEditor.resizeImage(width, height) client-side method.
How the tool dialog works:
The dimensions are always retrieved from the Width and Height text-boxes, and the resizing happens when the Resize button is clicked.
- The DropDownList contains a list of preset sizes, and the user can easily select from them. Upon selection, the values in the Width and Height inputs are changed.
- The Percentage text-box can be used to specify new dimensions as a percentage from the original. It accepts values in the [0, 100%] interval. The values can be changed by using the Up and Down arrow keys.
There are two buttons that control the relationship between the Width and Height text-boxes: Constrain proportions and Swap dimensions. The first is used to lock the ratio between the width and height and keep the aspect ratio. By default the aspect ratio is preserved.
The second gives the possibility to easily exchange the values of the width and height.