If you are resizing images, especially JPEG images in GDI plus you should definitely play around with the Graphics object’s InterpolationMode property. If you use the default mode for resizing, especially if size down to thumbnail size from rather large images you will probably find your pictures pixelized or showing ragged lines at any hard angles in the picture. InterpolationMode will do away with this in many cases resulting in much smoother looking images.
Interpolation modes use different algorithms to resample the original image for its new size and try to render as close as possible in the new resolution. Most image manipulation programs like Photoshop and PaintShop Pro support many of the same Interpolation modes.
Here’s what I use in my ResizeImage routine I mentioned a while back for thumbnailing:
bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
...
This has made a huge difference in the quality of the thumbnails which I use in my Photo Album.
Another important thing to remember is that GDI+ does best with image sizes that are multiples of 16. If you resize images try to make the height and width a multiple of 16. According to the documentation this will allow GDI+ to maintain the original image quality attributes resulting in preservation of more of the settings when resizing.
These are relatively simple tweaks that have been a big help to me and I thought I’d pass it on here…
Other Posts you might also like