Thursday, September 27, 2012

Create thumbnail using c#



private void CreateThumbnail(string imgPath)
{
  try
  {
     Image photoImg = Image.FromFile(imgPath);
     Image thumbPhoto = photoImg.GetThumbnailImage(200,150,null,new System.IntPtr());
     thumbPhoto.Save(@"C:\aaa.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
   }
   catch (Exception exp)
   {
      MessageBox.Show("Select a valid photo!");
      return;
    }        
 }

No comments:

Post a Comment