In WPF I could do RenderOptions.BitmapScalingMode
, but this isn't available in Metro apps. Is there a way I can get better quality scaling when I scale an image down?

- 12,486
- 14
- 59
- 93

- 185
- 1
- 12
-
Welcome to Stack Overflow! Please, do not include information about a language used in a question title unless it wouldn't make sense without it. Tags serve this purpose. – Ondrej Janacek Mar 04 '14 at 07:05
1 Answers
You shouldn't use Fill for Stretch property if you want your image to keep its initial ratio.
Use Uniform, or UniformToFill.
More info here : http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.image.aspx http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.image.stretch.aspx http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.stretch.aspx
Next, on the subject of scaling down an Image, there already is an answer here : High quality image scaling.
Basically, use DecodePixelHeight or DecodePixelWidth, or better, use a different source image.
http://msdn.microsoft.com/en-us/library/windows/apps/hh465362.aspx
Don’t use larger images that are scaled down Larger images that are scaled down show scaling artifacts and jagged edges on standard tablets. Photographs are the only exception as they can look good when scaled down. You should ensure that your images look great on the 100% scale using the above guidance.
-
I have a grid with a maximum size. The grid is filled at run time with an image from a web source. The image could be larger than the grid, so I catch the load event and set the grid column to max, which scales the image down. How can I use DecodePixel if the grid is scaling the image down for me? – Rj Geraci Mar 04 '14 at 15:36
-
I don't know if I understand correctly, but I think you are saying your image is displayed once within your grid, then scaled down just after when you set the size of the grid column. I any case, maybe you should compute your desized image size before putting your image in your grid, thus fixing it with DecodePixelWidth (or Height). Can you try this method with DecodePixel(Width|Height) to see if the result image suits your needs (good enough quality) ? – Drenskin Mar 05 '14 at 08:03
-
I set the image DecodePixel size first like you suggested, but the quality is still very poor. I think the problem is the size difference, I'm going from images that could be 1000+ down to 150 max. – Rj Geraci Mar 05 '14 at 14:12