title: Converting image from project folder
body: <p>I am trying to convert a image in my image folder and the image name <code>defaultImage</code> and update into my database table.</p>
  
  <p>But now I am having problem in this line of code:</p>
  
  <p>I change the code using this:</p>
  
  <p><code>Image uploaded6 = Image.FromFile("/image/defaultImage.jpg");</code></p>
  
  <p>instead of this:</p>
  
  <p><code>System.Drawing.Image uploaded = System.Drawing.Image.FromStream(</code>~/images/defaultImage<code>);</code> </p>
  
  <p>I now getting the error of <code>FileNotFoundException was unhandled by user code</code></p>
  
  <p>I have tried this method using fileupload control and it working fine but not sure how to convert image in a folder.</p>
  
  <p>How do I get the image from the folder in order to convert it using the method shown below. </p>
  
  <pre><code>Image uploaded6 = Image.FromFile("/image/defaultImage.jpg");
  
  //System.Drawing.Image uploaded = System.Drawing.Image.FromStream();
  
  System.Drawing.Image newImage = new Bitmap(1024, 768);
  using (Graphics g = Graphics.FromImage(newImage))
  {
      g.InterpolationMode = InterpolationMode.HighQualityBicubic;
      g.DrawImage(uploaded, 0, 0, 1024, 768);
  }
  
  byte[] results;
  using (MemoryStream ms = new MemoryStream())
  {
      ImageCodecInfo codec = ImageCodecInfo.GetImageEncoders().FirstOrDefault(c =&gt; c.FormatID == ImageFormat.Jpeg.Guid);
      EncoderParameters jpegParms = new EncoderParameters(1);
      jpegParms.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
      newImage.Save(ms, codec, jpegParms);
      results = ms.ToArray();
  }
  
  string sqlImage = "update MemberReport set image1 = @Data where memberreportid = '" + Session["memberreportid"] + "'";
  SqlCommand cmdImage = new SqlCommand(sqlImage);
  cmdImage.Parameters.AddWithValue("@Data", results);
  InsertUpdateData(cmdImage);
  </code></pre>