title: Asp.net reduced image size in kb
body: <p>I posted this other topic, got some gentle replies, but although the answers resolved the quality side of the question they created another issue with the image size in kb.
  <a href="https://stackoverflow.com/questions/21367007/asp-net-image-resizing-quality">Asp.net image resizing quality</a></p>
  
  <p>Here is the issue.</p>
  
  <p>I have a 2MB image that I want to reduce to 480px width.</p>
  
  <p>I used three different ways to resize it:</p>
  
  <p>1) On Fileupload ran this code:</p>
  
  <pre><code>System.IO.Stream st = FileUploadPost.PostedFile.InputStream;
  myImage = System.Drawing.Image.FromStream(st);
  thumb = myImage.GetThumbnailImage(newWidth, newHeight, null, System.IntPtr.Zero);
  thumb.Save(myPath);
  </code></pre>
  
  <p>Benefits: Size in kb becomes small (around 80Kb).</p>
  
  <p>Downside: Visual quality is horrible</p>
  
  <p>2) On Fileupload ran this code (solution provided on the mentioned post):</p>
  
  <pre><code> Bitmap newImg = new Bitmap(newWidth, newHeight,    System.Drawing.Imaging.PixelFormat.Format24bppRgb);                            
   Graphics newGraphic = Graphics.FromImage(newImg);
   newGraphic.DrawImage(myImage, 0, 0, newWidth, newHeight);
   newGraphic.Dispose();
   newImg.Save(myPath); 
  </code></pre>
  
  <p>Benefits: Visual quality is good</p>
  
  <p>Downside: Size continues very big (around 400kb)</p>
  
  <p>3) Used Windows Paint software and "manually" reduced the image to 480px width</p>
  
  <p>Benefits: Benefits of both 1) and 2) -> Visual quality is good and size is reduced to around 80kb</p>
  
  <p>Question is:</p>
  
  <p>What is the code that reproduces item 3 behaviour (good visual quality and smaller size in kb)?</p>
  
  <p>Thanks</p>