Resizing gives me to heavy image
        Posted  
        
            by phenevo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by phenevo
        
        
        
        Published on 2010-06-18T09:17:24Z
        Indexed on 
            2010/06/18
            9:23 UTC
        
        
        Read the original article
        Hit count: 202
        
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;
}
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 !
© Stack Overflow or respective owner