ComponentOne Imaging for Silverlight Library
Resizing the Image
Bitmap > Working with Bitmap for Silverlight > Resizing the Image

The second most useful image editing task is resizing, or scaling, an image. C1Bitmap provides us with easy ways to resize the image. Most of the work in this part is actually just creating the UI to capture the input from the user. In this sample, we display a Child Window prompting for a new Width and Height for the image. Then we pass these values to our resizing method which will do the work and replace the existing image with the new size. Ideally, we will want to constrain proportions on the resize action but also allow the user to resize freely. This can be handled entirely through the UI and not rely on the bitmap component.

 

C#
Copy Code
void ResizeImage(int w, int h)
 {
     bitmap = new C1Bitmap(bitmap, w, h);
     UpdateImage(true);
 }