Hi,
I'm resizing jpeg 1200x900 ,556kb by method:
public static Image ResizeImage(Image imgToResize, int height) //height=400
{
int destWidth;
int destHeight;
int sourceWidth = imgToResize.Width;
int sourceHeight = imgToResize.Height;
float nPercent = 0;
float nPercentH = 0;
nPercentH = ((float)height / (float)sourceHeight);
nPercent = nPercentH;
destWidth = (int)(sourceWidth * nPercent);
destHeight = height;
Bitmap b = new Bitmap(destWidth, destHeight);
Graphics g = Graphics.FromImage((Image)b);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
g.Dispose();
return b;
}
SavingŁ
Image image = Image.FromStream(new FileStream(path, FileMode.Open));
Image imageAfterResizing =ResizeImage(image,400);
imageAfterResizing.Save(@"c:\myPhoto.jpg");
gives me 555kb 533x400 jpeg.
Why this photo is so heavy.
For photo jpeg 2111kb 2156x1571 I get 556kb 533x400 jpeg
Why in first case is so terrible !
http://img6.imageshack.us/img6/1127/photo1nz.jpg http://img248.imageshack.us/img248/8063/photo2y.jpg