![]() |
| ||
| Retaining highest res. of a photo in upload? Anyone know of a work around in .Net to retain the highest possible resolution of a photo or image after compression or resizing? |
| ||
| Re: Retaining highest res. of a photo in upload? Use this code: Dim g As Graphics = Graphics.FromImage(YourBitmap) And when saving use this: Dim myParams As EncoderParameters = New EncoderParameters(1) This is GetEncoderInfo function: Public Function GetEncoderInfo(ByVal MimeType As String) As ImageCodecInfo |
| ||
| Re: Retaining highest res. of a photo in upload? Wow- that was quick. I am a designer researching this for my programmer -- who is too slammed to research this. We are trying to keep the highest quality for uploaded photos, much like www.flickr.com does for it's members. When you upload a 4000px by 2000px 5 meg image to (Flickr) it will compress to 1/2 or 2.5 meg and display at the appropriate aspect ratio for their site. Our .Net app is compressing the photo file sizes much smaller, where as uploading a test photo to Flickr will sace at 58760 Kb our app. will save the same photo at 17240 Kb. I will share your feedback with him. Thank you for taking the time to reply. It is greatly appreciated. Rick |
| ||
| Re: Retaining highest res. of a photo in upload? ManicCW Here is the string we are using (C#) 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); |
| ||
| Re: Retaining highest res. of a photo in upload? The only thing that you are missing is EncoderParameters. Use the above code to set quality of saved image. |
| All times are GMT -4. The time now is 4:27 am. |
Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC