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

Creating thumbnails - 10.06.2008

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

Add Comment
First Name Last Name
Web Site
E-Mail
Comment
Security Picture

Photos
Me in MSDN Forums
-   Answered the question How can i get it in the Visual C# General forum
-   Answered the question How to add the VAT to the ammount in the Visual Basic General forum
-   Contributed a proposed answer to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Replied to the question How can i get it in the Visual C# General forum
-   Replied to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Answered the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Contributed a proposed answer to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Answered the question Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Replied to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
Entries
News
Articles