Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Generate and Modify Images with GDI+  : Page 4

Use GDI+ and the System.Drawing classes to simplify the process of manipulating images.




Application Security Testing: An Integral Part of DevOps

Creating Thumbnail Images
You can use a similar technique to create a true thumbnail of your image. The Image class supports a GetThumbnailImage method which generates thumbnails. For example:

const string cstrThumbFileName = "\\Thumb_Sample.gif"; System.Drawing.Image img = System.Drawing.Image.FromFile (strFileName); System.Drawing.Image.GetThumbnailImageAbort imgCallBack = new System.Drawing.Image.GetThumbnailImageAbort (CallBackMethod); System.Drawing.Image imgThumbnail = img.GetThumbnailImage(img.Width/4, img.Height/4, imgCallBack, IntPtr.Zero); imgThumbnail.Save (Application.StartupPath + cstrThumbFileName);

Calling the GetThumbnailImage method and passing in the width and height of the thumbnail, along with an Image.GetThumbnailImageAbort delegate and IntPtr.Zero creates a new instance of the Image object that represents the thumbnail of your original image.

Author Note: The Image.GetThumbnailImageAbort delegate and IntPtr.Zero parameters are required even though they support a callback that is not yet used in GDI+ 1.0.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date