It's tempting to use GDI+'s GetThumbnailImage method when you need to manipulate the size of images in your applications, but you'll pay for it with image degradation. There's a better way. Use the ResizeImage API in this article to do whatever you like with images and never drop a pixel (unless you want to).
by Alex Hildyard
October 1, 2004
ne of the many improvements of .NET's GDI+ over its Win32-based predecessor is its high-level image processing API. It's a doddle for Web servers running ASP.NET to stream JPEG data on the fly, and standalone desktop applications also benefit from a good set of methods to load, save, and convert image data from a variety of resources and media. However, just because it's easy to do something with GDI+ doesn't necessarily mean you should use it, and one place you're likely to get stungsooner or lateris when you try to resize an image.
The System.Drawing.Image and System.Drawing.Bitmap namespaces have every manner of method to manipulate image formats and properties, and bang!in the middle of both namespaces is one method that looks exactly like what you want:
Image GetThumbnailImage(int thumbWidth, int thumbHeight ...)
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!