Register   Login
     
  View Article  
24

I've spent the majority of the afternoon improving the quality of images resized in Simple Gallery.

The enhancements started with the suggestions in the following blog entry.

1.) Jpeg Quality Setting

System.Drawing.Imaging.ImageCodecInfo [] Info = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();   
System.Drawing.Imaging.EncoderParameters Params = new System.Drawing.Imaging.EncoderParameters(1);
Params.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
Response.ContentType = Info[1].MimeType;
thumbnail.Save(Response.OutputStream,Info[1],Params);

What this means for Simple Gallery, is an additional setting in view options for selecting between compression "Quality" or "Minimum Size" (what it currently is).

2.) Graphic Object Options

graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.SmoothingMode = SmoothingMode.HighQuality;
graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphic.CompositingQuality = CompositingQuality.HighQuality;

Again, this means setting these options when "Compression" is set to Quality.

3.) GIF Improvements

The last goal was the GIF improvements as images uploaded as GIF can be terrible and pixelated. What I learnt was this is not unique to my development, and managed code has a real problem dealing with GIFs. Every solution that I found relied on "unsafe" code and would certainly not run in medium trust (the default for DotNetNuke).

Here are some of the solutions found, but they require either special permissions or run lower then medium trust:-

Results

So, I've implemented option #1 and #2, can you spot the differences in the generated images?

Image 1

Image 2

Conclusion

The only problem is that the photo resized with the quality setting is considerably larger then the other, but then that's why the config option is there.

Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

Enter the code shown above: