Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

10.06.2008
Creating thumbnails

In order to generate the thumbnails of the pictures that users have uploaded in our applications, we can use the method below:

public void SaveThumbnail(string path,string thumbnailPath,int newWidth,int newHeight)
        {
            System.Drawing.Image i = System.Drawing.Image.FromFile(path);
            System.Drawing.Image thumbnail = new System.Drawing.Bitmap(newWidth, newHeight);
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumbnail);
            g.DrawImage(i, 0, 0, newWidth, newHeight);
            thumbnail.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
        }


Code
Comments(0)

Photos
Entries
News
Articles