Retaining highest photo resolution in upload for display

Discussion in 'Programming' started by rickvidallon, Apr 8, 2007.

  1. #1
    I have a .Net application written in C# where members may upload their photos and have them displayed on our website. We are trying to maintain the best quality using best settings in .Net for this.

    A good commercial comparison is as follows;
    I uploaded a photo to www.flickr.com. http://www.flickr.com/photos/visionefx/446635882/in/photostream/
    The photo contains 73076 kbs. --- When I upload the 'same photo' to our application it saves it at 13076 kbs. That's nice for speed but not very good for quality.

    Here is the settings we are using:
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    System.Drawing.

    Image image1 = System.Drawing.Image.FromFile(Server.MapPath(imgfilepath + actimgFilename));
    System.Drawing.

    Image smallimage = new Bitmap (imgNewWidth, imgNewHeight, image1.PixelFormat);

    Graphics oGraphic = Graphics.FromImage(smallimage);
    oGraphic.CompositingQuality =

    CompositingQuality.HighQuality;
    oGraphic.SmoothingMode =

    SmoothingMode.HighQuality;
    oGraphic.InterpolationMode =

    InterpolationMode.HighQualityBicubic;
    oGraphic.PixelOffsetMode =

    PixelOffsetMode.HighQuality;

    Rectangle oRectange = new Rectangle (0, 0, imgNewWidth, imgNewHeight);
    oGraphic.DrawImage(image1, oRectange);

    smallimage.Save(Server.MapPath(imgfilepath + newFilename), System.Drawing.Imaging.

    ImageFormat.Jpeg);
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    Thanks in advance,
    Rick
     
    rickvidallon, Apr 8, 2007 IP