.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to get thumbnail of an Image?

Posted By:Jean Paul       Posted Date: October 07, 2010    Points: 15    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Thumbnails are reduced-size versions of pictures. Using the Bitmap class we can create reduced version of images. That would be memory efficient if we are dealing with a bulk of images to be shown as thumbnail. Instead of shrinking the original sized image, we can create a thumbnail using the GetThumbnail() method in C#.
 

// Create a windows forms application with 2 picture boxes. Keep the picture in a picturbox1

Bitmap bitmap = new Bitmap(pictureBox1.Image);
Image.GetThumbnailImageAbort callback = delegate () { return false; };
Image thumbnail = bitmap.GetThumbnailImage(20, 20,callback, IntPtr.Zero);

pictureBox2.Image = thumbnail;

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend