I am resizing uploaded images as follows:
var bmPhoto = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
using (var grPhoto = Graphics.FromImage(bmPhoto))
{
grPhoto.SmoothingMode = SmoothingMode.HighSpeed;
grPhoto.CompositingQuality = CompositingQuality.HighSpeed;
grPhoto.InterpolationMode = InterpolationMode.Low;
grPhoto.DrawImage(sourceImage, new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel);
}
How can I limit the resulting file size so that it is no bigger than, say, 3KB? I am uploading a 1024x768 JPG which is 768KB. When resizing to 100x100 with the above code, I can't get it any smaller than 12KB.