在xaml中调整图像大小而不会降低质量 [英] Resize image in xaml without losing quality

查看:78
本文介绍了在xaml中调整图像大小而不会降低质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这张图片(原始尺寸:256x256)

I have this image (original size: 256x256)

我做了这个xaml定义以在我的应用程序中显示图像

I made this xaml definition to show the image in my application

<Image Grid.Row="1" 
       Source="/MyProject;component/Images/happy.png" 
       Stretch="Fill" 
       Width="64" Height="64"  
       VerticalAlignment="Top" Margin="0,0,0,0" 
       HorizontalAlignment="Center" />

我得到这个结果

如何进行更平滑的调整?

How can I made a more smooth resize?

推荐答案

在图像中包含RenderOptions.BitmapScalingMode="Fant",如下所示:

Include RenderOptions.BitmapScalingMode="Fant" on your Image, like so:

<Image Grid.Row="1"
       Source="/MyProject;component/Images/happy.png"
       RenderOptions.BitmapScalingMode="Fant"
       Stretch="Fill"
       Width="64"
       Height="64"
       VerticalAlignment="Top"
       Margin="0,0,0,0"
       HorizontalAlignment="Center" />

这篇关于在xaml中调整图像大小而不会降低质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆