O'Reilly logo

Graphics Programming with GDI+ by Mahesh Chand

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.11. Saving Images with Different Sizes

Sometimes we need to save an image with a different size than it originally had. As we discussed earlier, the Save method of the Image class is used to save images. This method also allows us to specify the size of a saved image.

To make our program even more interesting, we will determine the size of the saved image at runtime. Create a Windows application and add two text boxes, two tables, and a button control to the form. The text boxes are used to specify the height and width of the saved image, and the button is used to save the image with the new size, as shown in Figure 7.42.

Figure 7.42. Saving images with different sizes

First we specify an Image private variable:

 private Image curImage; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required