Tag Archives: image
Resizing an image in C#
Posted on 26. Jan, 2010 by Wim Haanstra.
For a project I am working on, I was looking for a good way to resize images in a few different ways. I have done image resizing before, but it really feels that I am re-inventing the wheel every time I do this. So now I decided to write a nice static method which can resize an Image to certain dimensions and outputs an Image object again.
The method requires 3 parameters:
1. An image object. I hope you know how to load a file in an Image object (hint: FromFile).
2. A Resolution object, being nothing more than a small class I created, which also contains the width and the height.
3. The mode you want to use for resizing the image. I explained the modes in the enum listed below.
It probably isnt the neatest code you’ve ever seen, so if you have any comments, please let me know. Code and more explanation after the break… (more…)
Continue Reading