如何为 WP 8.1 Store 应用程序创建多缩放图像资产 [英] How to create multi scaled image assets for a WP 8.1 Store app

查看:19
本文介绍了如何为 WP 8.1 Store 应用程序创建多缩放图像资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为不同的比例因子创建特定的图像资产?例如,我有一个使用图像的按钮.那么,如何为 Scale 100、Scale 140 和 Scale 240 创建该图像?

How to create specific image assets for different scale factors? For example, I have a button which uses an image. So, how to create that image for Scale 100, Scale 140 and Scale 240?

推荐答案

您为 96dpi 设备创建原始图像,比如说 40x40,那么您应该提供 56x56 (140%)、72x72 (180%) 等等.如果您不提供图片,图片将被调整大小并降低其质量.

You create original image for 96dpi device, let's say 40x40, then you should provide 56x56 (140%), 72x72 (180%) and so on. If you don't provide the image, the image will be resized and loose its quality.

您可以为每个比例提供图像并将它们放在同一个文件夹中,如下所示:

You can provide images for every scale and place them in the same folder, like this:

Images/name.scale-100.png
Images/name.scale-140.png
Images/name.scale-180.png
Images/name.scale-240.png

然后你可以像这样引用 XAML 中的图像:

Then you can refer to the image in XAML like this:

<Image Source="Images/name.png"/>

并在代码中通过其 URI:

and in the code by its URI:

Uri imageUri = new Uri("ms-appx:///Images/name.png");

操作系统应该以适当的比例拍摄图像.您可以在 MSDN 上找到更多相关信息.

The OS should take the image with the apropriate scale. More about this you will find at MSDN.

另请注意,您也可以通过这种方式设置高对比度和/或不同语言的图像.

Note also that you can set this way also images for high-contrast and/or different languages.

这篇关于如何为 WP 8.1 Store 应用程序创建多缩放图像资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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