Dim g As Graphics = Graphics.FromImage(YourBitmap)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.PixelOffsetMode = PixelOffsetMode.HighQuality
And when saving use this:
Dim myParams As EncoderParameters = New EncoderParameters(1)
myParams.Param(0) = New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 80)
YourBitmap.Save(YourPath, GetEncoderInfo(MimeType), myParams)
This is GetEncoderInfo function:
Public Function GetEncoderInfo(ByVal MimeType As String) As ImageCodecInfo
Dim j As Integer
Dim encoders As ImageCodecInfo()
encoders = ImageCodecInfo.GetImageEncoders()
j = 0
Do While j < encoders.Length
If encoders(j).MimeType = MimeType.Trim.Replace("pjpeg", "jpeg") Then
j += 1
Wow- that was quick. I am a designer researching this for my programmer -- who is too slammed to research this. We are trying to keep the highest quality for uploaded photos, much like www.flickr.com does for it's members.
When you upload a 4000px by 2000px 5 meg image to (Flickr) it will compress to 1/2 or 2.5 meg and display at the appropriate aspect ratio for their site.
Our .Net app is compressing the photo file sizes much smaller, where as uploading a test photo to Flickr will sace at 58760 Kb our app. will save the same photo at 17240 Kb.
I will share your feedback with him. Thank you for taking the time to reply. It is greatly appreciated.