Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Generate and Modify Images with GDI+  : Page 4

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


advertisement
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.

 

 

Sitemap