Reply to topic
Retaining highest res. of a image upload for display in C#
rickvidallon


Joined: 15 Nov 2004
Posts: 26
Location: Virginia Beach,VA
Reply with quote
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
MSDN Example
ZenPhil


Joined: 12 Apr 2007
Posts: 1
Reply with quote
It sounds like the problem might be with the level of compression being used when you save as JPEG. If so, I believe you might find the following sample on MSDN helpful:

http://msdn2.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality.aspx

You could also try saving the file using a lossless format such as TIFF.
Retaining highest res. of a image upload for display in C#
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic