Getting and Saving Thumbnail Image from Orginal Image in the User Specified path using System.Drawing c#


Getting and Saving Thumbnail Image from Orginal Image in the Specified path using System.Drawing c#

 

//Getting Thumbnail of orginal Image

        public void GetThumbnailUsingPath()

        {

            //Just an simple call back.

            Image.GetThumbnailImageAbort myCallback =

            new Image.GetThumbnailImageAbort(ThumbnailCallback);

 

            //Getting image from the path.

            Bitmap myBitmap = new Bitmap(Server.MapPath("scenary.jpg"));

 

            //Convert Image as Thumbnail with given size.

            Image myThumbnail = myBitmap.GetThumbnailImage(

            40, 40, myCallback, IntPtr.Zero);

 

            //Get the current response

            HttpResponse response = GetHttpResponse();

 

            //Saves image to the specified location in the JPG format

            myThumbnail.Save(@"D:\ScenaryThumbnai.jpg");

        }

 

        public bool ThumbnailCallback()

        {

            return false;

        }

 

Thanks for reading this article. Have a nice day.

 

Ebook Download
View all
Learn
View all