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. Asp.net image resizing quality
Here is the issue.
I have a 2MB image that I want to reduce to 480px width.
I used three different ways to resize it:
1) On Fileupload ran this 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);
Benefits: Size in kb becomes small (around 80Kb).
Downside: Visual quality is horrible
2) On Fileupload ran this code (solution provided on the mentioned post):
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);
Benefits: Visual quality is good
Downside: Size continues very big (around 400kb)
3) Used Windows Paint software and "manually" reduced the image to 480px width
Benefits: Benefits of both 1) and 2) -> Visual quality is good and size is reduced to around 80kb
Question is:
What is the code that reproduces item 3 behaviour (good visual quality and smaller size in kb)?
Thanks