【发布时间】:2012-10-18 07:45:47
【问题描述】:
我已经阅读了这个问题,High Quality Image Scaling Library,但它只与 GDI+ 有关。
当我在我的应用中缩小Image 时,它变得非常锯齿。
我在 Image 类上找不到任何可以提高缩小质量的属性。
我该怎么做?
编辑:
我现在已经使用了这个代码:
BitmapImage img = new BitmapImage();
img.UriSource = new Uri(Graphic, UriKind.Relative);
return img;
其中Graphic 是一个包含图像路径的string,但我得到了这个异常:
Weather.DLL 中出现“System.ArgumentException”类型的异常,但未在用户代码中处理
附加信息:给定的 System.Uri 无法转换为 Windows.Foundation.Uri。详情请见http://go.microsoft.com/fwlink/?LinkID=215849。
据我所知,Windows.Foundation.Uri 未在 .net 框架中使用。
那么为什么会出现这个错误呢?
【问题讨论】:
-
你说的是哪个 Image 类?
-
你缩小图像的因素是什么?
-
你能发布你的代码吗?
-
@PaoloMoretti 我的代码基本上只是一个设置较小宽度和高度的
<Image>标签。 -
我认为你不能在 XAML 中做到这一点。 WPF 有一个附加属性
RenderOptions.BitmapScalingMode来更改插值模式,但这在 WinRT 中不可用。您可能必须在代码隐藏中创建一个新的缩放图像。 This post 可能会对您有所帮助。
标签: c# xaml windows-8 microsoft-metro windows-runtime