Compression not very good.

Feb 17, 2009 at 8:41 PM

I currently have a .NET control that I use to allow uploading of images. Yes, I know this requires the .net framework to be installed locally and some security access code set (I currently do this with a setup file). So this doesn't work to well with every browser and os platform. Thus that is why I am looking at this control.

So I am using my current code and comparing to the file uploaded by the this control. Two problems. First the compression is 6 times larger using the Silverlight File Upload and the Quality is actually worse.

Here is the code I currently use,
----------------------------------------------------------
Bitmap bmpSource = new Bitmap(g);
Bitmap bmpOutput = new Bitmap(newWidth, newHeight);

Graphics g2 = Graphics.FromImage(bmpOutput);

g2.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g2.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g2.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

g2.DrawImage(bmpSource, 0, 0, newWidth, newHeight);
System.IO.FileStream gStream = new System.IO.FileStream(@"C:\Documents and Settings\user1\Desktop\" + strNewFileNameHi, System.IO.FileMode.Create);
bmpOutput.Save(gStream, System.Drawing.Imaging.ImageFormat.Jpeg);

gStream.Flush();
gStream.Close();
----------------------------------------------------------

so I took an image that is 1024 x 768, uploaded using both methods resizing to 640x480. Here is what I got. 

SilverLight File Upload -> size is 332K (Quality is poor)
Custom Control             ->  size is  65K  (Quality is clear)

Do you think I'm doing something wrong?

Thanks,

 

Feb 18, 2009 at 1:18 PM
After changing the "quality" parameter the size came more in line with what GDI+ is doing; however, the image after resizing is still not very "good". you can tell a big difference on the "look".
Feb 18, 2009 at 4:06 PM
Unfortunately, it is the fluxcapacity (http://fluxcapacity.net/open-source/) code that is doing the resizing. If the quality is important, then I would suggest having the user upload the picture and then doing the resizing on the server using your .Net code.
Hope this helps,
Darick


From: [email removed]
To: [email removed]
Date: Wed, 18 Feb 2009 05:18:51 -0800
Subject: Re: Compression not very good. [SilverlightFileUpld:47397]

From: jwisener
After changing the "quality" parameter the size came more in line with what GDI+ is doing; however, the image after resizing is still not very "good". you can tell a big difference on the "look".
Read the full discussion online.
To add a post to this discussion, reply to this email (SilverlightFileUpld@discussions.codeplex.com)
To start a new discussion for this project, email SilverlightFileUpld@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Want to do more with Windows Live? Learn “10 hidden secrets” from Jamie. Learn Now
Feb 18, 2009 at 4:20 PM
Doesn't help much. I have downloaded the FJCore library and I'm trying to work in bicubic interp... algorithm into the core.
May 21, 2009 at 4:53 AM

Has there been any progress on implementing bicubic interp? This is a must-have as I evaluate Silverlight uploaders...

Roger

May 21, 2009 at 4:42 PM

I believe silverlight 3 will have the ability to resize images.  I haven't tried it yet however.  Once version 3 is released I will update the code to use it instead.

Darick