My contemplations and diurnal novelties are publicized here


You can simply create a thumbnail using following code:-

 

private void CreateThumbNail(string fileName)

        {

            // create an image object for source file

            System.Drawing.Image image = System.Drawing.Image.FromFile(fileName);

            // get another image instance using GetThumbnailImage method  NOTE:- A CALLBACK DELEGATE IS NEED HERE

            System.Drawing.Image thumbNail = image.GetThumbnailImage(100, 100, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

            // Save the thumbnail to another directory with same name

            fileName = fileName.Replace("\\gallery500\\", "\\thumbnail\\");

            // Create a file stream to be passed to thumbnail save method

            System.IO.FileStream fs = new FileStream(fileName, FileMode.Create);

            // Save the thumbnail

            thumbNail.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);

            // close file stream

            fs.Close();

        }

        public bool ThumbnailCallback()

        {

            return true;

        }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: