简体   繁体   中英

Creating high resolution image

I have an image (png) with resolution 1600*1200 (96 dpi).

I have put some text on the image and then saved it to a file for it to be loaded using silverlight's deepzoom with the pivotviewer. The text is blurry when zooming in and I was wondering how I can make the text look sharper (only if zooming in a bit).

This is my first bit of programming with images/graphics, so any info would be great (ie links to read, concepts to understand etc)

JD.

I've never used these controls before, but you might end up having to override the zooming algorithm (if that's even possible, I don't know). If you have text in an image and you're not using vector-based images (SVG, EMF, WMF, etc.), any sort of stretching is going to be blurry.

A different zooming algorithm, if it's a possibility, can decide how to stretch the pixels. For text, you're looking for something called "Nearest Neighbor" or maybe even "Bi-cubic" interpolation while the image is resizing. These methods are more expensive in terms of processing, so you might not get as smooth of a zoom as with the default interpolation algorithm (whatever it is).

There are some forum posts that start the same discussion, but with no real direction. Maybe you can follow them and see how they progress. I'm afraid I can't be of much help otherwise.

http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/dee528a2-06ae-4426-b096-5baafec499ff

http://weblogs.asp.net/bleroy/archive/2009/12/10/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi.aspx

In the last post they refer to the different interpolation algorithms in a BitmapScalingMode enumeration. One of those options is NearestNeighbor . There are also some examples of resized images.

Update:

In this article , the author takes a look at a way to change the quality of the image tiles that the Deep Zoom control uses (and he's using Silverlight!). The author effectively changes the way images are created with a few lines of code in his project:

if (bSmoothScaling)
{
  g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
  g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
  g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
}

In that list of assignments you can find the interpolation mode I've been mentioning, as well as some other things I wasn't aware of. The author does mention a significant impact on performance with everything set to "High Quality."

Hopefully you can take the concept and incorporate it into Silverlight somehow. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM