加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

wpf – Windows 10所有DPI设置上的所有图标分辨率?格式?像素艺

发布时间:2020-12-14 02:47:09 所属栏目:Windows 来源:网络整理
导读:只需跳到答案部分的答案,问题部分就有猜测和错误.答案是基于实验而且准确无误. 很长一段时间我使用了一个png打包的256px ico文件用于我的Visual Studio项目,它运行良好,导致缩放在这些图标上工作正常,几乎没有空间,我之前并不在意. 但现在我有一个需要“保留
只需跳到答案部分的答案,问题部分就有猜测和错误.答案是基于实验而且准确无误.

很长一段时间我使用了一个png打包的256px ico文件用于我的Visual Studio项目,它运行良好,导致缩放在这些图标上工作正常,几乎没有空间,我之前并不在意.

但现在我有一个需要“保留硬边”的图标,它是“像素艺术”.
如果我使用256px版本进行缩减版本非常糟糕,或者如果我构建的16px版本略微不那么糟糕但不够好.所以我的问题是:

>我需要生成哪些大小才能合并到ico中(我不关心pre win7图标)?
>如果我得到该列表,我是否必须为高dpi设置生成1.25x,1.5x和2.0x版本?
>最后,像firefox这样的应用程序在中型方块内的开始菜单上有一个大图标,我的应用程序在中心有一个像Visual Studio那样的小应用程序,我怎样才能在开始菜单中放置一个大图标?

我确实找到了它:不幸的是VS说:Windows Presentation Foundation(WPF)项目不支持VisualElements.有没有解决的办法?

我环顾四周,收集了可能的尺寸@ 1x(96DPI):
16,20,24,30,32,40,48,50,64,128,150,256,512,768
大多数情况下,我从Which icon sizes should my Windows application’s icon include?收集这些.

没那么糟糕,但如果我添加1.25x,1.5x,2.0x然后我们得到:
16,25,36,38,45,60,62,72,75,80,96,100,160,188,192,225,300,320,384,640,768,960,1024,1152,1536在我的例子中,它制作了一个500k的ico文件,因为看起来1024是你可以放入ico文件的最大分辨率,我的图标是像素化的,所以用png压缩得很好,仍然~~~~~~~~~~~~~

我还制作了一个ico,它具有rgba中的所有上述分辨率,并且每个都有它的大小,所以你可以看到哪些窗口加载了哪个dpi设置.你可以从here下载并在vs项目中使用它进行测试.

据我所知,256px下的所有内容都无法压缩,这是对的吗?

我是否需要所有这些尺寸来保留像素完美图标?只有32位(RGBA)png好吗?我希望我不需要包括其他深度.

在我从规范中写了一个ico writer之后,我意识到png可以有0分辨率因为x或y可以使用1个字节(但我从未见过非正方形的ico,也许curs可以是非正方形),在此case可能是文件中的第一个用零分辨率来使用…这不确定,但我认为它离真相不远.看图像.重新调整问题仍然让我感到困惑,如果我明天有一些时间我会测试它.像素完美图标似乎是不可能的:将一个图像重新缩放到256px以上的任何值.

解决方法

答案:

在ICO文件中的256px下,PNG是否可以接受?
Microsoft声明256px以下的大小应该是没有前14个字节的BMP.
但至少在Windows 10的情况下,答案是肯定的.

你能在ICO中添加大于1024px的图像吗?
是.只要是PNG,就可以随心所欲.
请注意“超过255px的一个图标”限制:
您只能添加一个大于255px的图像(您可以添加更多图像,但窗口只能读取ICO头中分辨率为0,0的第一个图像块).格式为每个维度指定1个字节.见表#2.

所有DPI设置包括哪些尺寸?
Windows 10使用以下图标大小(参见下表):
16,28,31,42,47,56,63,84和大于255px的一个.

请注意,Windows RT应用程序不使用ICO文件,它们使用PNG或字体,这来自Firefox的来源:

<Application xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <VisualElements
      ShowNameOnSquare150x150Logo='on'
      Square150x150Logo='browserVisualElementsVisualElements_150.png'
      Square70x70Logo='browserVisualElementsVisualElements_70.png'
      ForegroundText='light'
      BackgroundColor='#0996f8'/>
</Application>

那么Firefox在中型磁贴的开始菜单上有一个大图标?
好吧,在快捷方式添加到开始菜单this article explains it how之前,它包含在exe目录中的上述文件.我的应用程序有一个示例.

Results

如果你为Windows 10制作图标,你最好使用我的工具和photoshop(或类似的东西),而不是其他任何东西,我试过编辑,他们很糟糕.

win10iconTools by me

您可以创建ICO文件(作为MS建议与否)或创建印有分辨率的图标,后者是我用来制作表格的图标.
支持多种调整大小模式,包括最近邻居.
如果你想在其他Windows版本上使用它,它可以使用.net2,测试另一个窗口,发送给我结果,并为了人类的利益扩展表格.

对于图标中的像素艺术,不可能是完美的:(除非我们可以在Windows 10中更改缩放算法.
因此,广泛的范围84-256得到缩放为“0”(见上文),所以没有真正的点添加大于256的东西,因为我看到它现在你应该为“0”创建256px图像.
(见表格原因)

如果Windows获取所有图标16到255,则大于255(表中为0)的1选择以下大小:
(所以这里没有降价表?,它的种类很宽,表格也在应用程序自述文件中)

|                                           |                 Windows 10                | 
|                                           |   96DPI  |  120DPI  |  144DPI  |  168DPI  | 
| icon                                      |disp.|load|disp.|load|disp.|load|disp.|load| 
|-------------------------------------------|-----|----|-----|----|-----|----|-----|----| 
| alt-tab                                   | 24  | 32 | 30  | 32 | 36  | 32 | 42  | 32 | 
| desktop large                             | 96  | 0  | 120 | 0  | 144 | 0  | 168 | 0  | 
| desktop medium                            | 48  | 48 | 60  | 60 | 72  | 72 | 84  | 84 | 
| desktop small                             | 32  | 32 | 40  | 40 | 48  | 48 | 56  | 56 | 
| explorer content,inc0                    | 32  | 32 | 40  | 40 | 48  | 48 | 56  | 56 | 
| explorer extra large                      | 256 | 0  | 256 | 0  | 256 | 0  | 256 | 0  | 
| explorer large                            | 96  | 0  | 120 | 0  | 144 | 0  | 168 | 0  | 
| explorer medium                           | 48  | 48 | 60  | 60 | 72  | 72 | 84  | 84 | 
| explorer small:inc4,list:inc3,details:inc2| 16  | 16 | 20  | 20 | 24  | 24 | 28  | 28 | 
| explorer tiles,inc1                      | 48  | 48 | 60  | 60 | 72  | 72 | 84  | 84 | 
| startmenu medium                          | 32  | 32 | 40  | 40 | 48  | 48 | 56  | 63 | 
| startmenu programs                        | 24  | 24 | 30  | 30 | 36  | 36 | 42  | 42 | 
| startmenu search                          | 32  | 60 | 40  | 60 | 48  | 60 | 56  | 0  | 
| startmenu tile small                      | 24  | 24 | 30  | 31 | 36  | 39 | 42  | 47 | 
| taskbar normal                            | 24  | 32 | 30  | 40 | 36  | 48 | 42  | 56 | 
| taskbar small                             | 16  | 16 | 20  | 20 | 24  | 24 | 28  | 28 | 
| window icon                               | 16  | 16 | 20  | 16 | 24  | 16 | 28  | 16 | 
| desktop inc0                              | 16  | 16 | 20  | 20 | 24  | 24 | 28  | 28 | 
| desktop inc1                              | 18  | 32 | 23  | 40 | 27  | 48 | 32  | 56 | 
| desktop inc2                              | 20  | 30 | 25  | 40 | 30  | 48 | 35  | 56 | 
| desktop inc3                              | 22  | 32 | 28  | 40 | 33  | 48 | 39  | 56 | 
| desktop inc4                              | 24  | 32 | 30  | 40 | 36  | 48 | 42  | 56 | 
| desktop inc5                              | 27  | 32 | 34  | 40 | 41  | 48 | 47  | 56 | 
| desktop inc6                              | 30  | 32 | 38  | 40 | 45  | 48 | 53  | 56 | 
| desktop inc7                              | 33  | 48 | 41  | 60 | 50  | 72 | 58  | 84 | 
| desktop inc8                              | 37  | 48 | 46  | 60 | 56  | 72 | 65  | 84 | 
| desktop inc9                              | 41  | 48 | 51  | 60 | 62  | 72 | 72  | 84 | 
| desktop inc10                             | 46  | 48 | 58  | 60 | 69  | 72 | 82  | 84 | 
| desktop inc11                             | 51  | 0  | 64  | 0  | 77  | 0  | 89  | 0  | 
| desktop inc12                             | 57  | 0  | 71  | 0  | 86  | 0  | 100 | 0  | 
| desktop inc13                             | 63  | 0  | 79  | 0  | 95  | 0  | 110 | 0  | 
| desktop inc14                             | 70  | 0  | 88  | 0  | 105 | 0  | 123 | 0  | 
| desktop inc15                             | 78  | 0  | 98  | 0  | 117 | 0  | 137 | 0  | 
| desktop inc16                             | 87  | 0  | 109 | 0  | 131 | 0  | 152 | 0  | 
| desktop inc17                             | 97  | 0  | 121 | 0  | 146 | 0  | 170 | 0  | 
| desktop inc18                             | 108 | 0  | 135 | 0  | 162 | 0  | 189 | 0  | 
| desktop inc19                             | 120 | 0  | 150 | 0  | 180 | 0  | 210 | 0  | 
| desktop inc20                             | 133 | 0  | 166 | 0  | 200 | 0  | 233 | 0  | 
| desktop inc21                             | 148 | 0  | 185 | 0  | 222 | 0  | 256 | 0  | 
| desktop inc22                             | 164 | 0  | 205 | 0  | 246 | 0  | 256 | 0  | 
| desktop inc23                             | 182 | 0  | 228 | 0  | 256 | 0  | 256 | 0  | 
| desktop inc24                             | 202 | 0  | 253 | 0  | 256 | 0  | 256 | 0  | 
| desktop inc25                             | 224 | 0  | 256 | 0  | 256 | 0  | 256 | 0  | 
| desktop inc26                             | 249 | 0  | 256 | 0  | 256 | 0  | 256 | 0  | 
| explorer inc5                             | 18  | 32 | 23  |    |     |    |     |    | 
| explorer inc6                             | 20  | 32 | 25  |    |     |    |     |    | 
| explorer inc7                             | 22  | 32 | 28  |    |     |    |     |    | 
| explorer inc8                             | 23  | 32 | 29  |    |     |    |     |    | 
| explorer inc9                             | 25  | 32 | 31  |    |     |    |     |    | 
| explorer inc10                            | 27  | 32 | 34  |    |     |    |     |    | 
| explorer inc11                            | 29  | 32 | 36  |    |     |    |     |    | 
| explorer inc12                            | 31  | 32 | 39  |    |     |    |     |    | 
| explorer inc13                            | 33  | 48 | 41  |    |     |    |     |    | 
| explorer inc14                            | 35  | 48 | 44  |    |     |    |     |    | 
| explorer inc15                            | 38  | 48 | 48  |    |     |    |     |    | 
| explorer inc16                            | 41  | 48 | 51  |    |     |    |     |    | 
| explorer inc17                            | 44  | 48 | 55  |    |     |    |     |    | 
| explorer inc18                            | 47  | 48 | 59  |    |     |    |     |    | 
| explorer inc19                            | 50  | 0  | 63  |    |     |    |     |    | 
| explorer inc20                            | 54  | 0  | 68  |    |     |    |     |    | 
| explorer inc44                            | 239 | 0  | 256 | 0  |     |    |     |    | 
| explorer inc45                            | 256 | 0  | 256 | 0  |     |    |     |    |

桌面上有27个缩放增量
和浏览器上的45个缩放增量(包括“底层”菜单中的默认值)

图标格式规范:

|**block**  |**offset** |**offset** |**length** |**description**                |
|-----------|-----------|-----------|-----------|-------------------------------|
|main header|   0       |           |   2       |Reserved=0                     |
|           |   2       |           |   2       |Image type: 1(.ICO) 2(.CUR)    |
|           |   4       |           |   2       |Number of images in container  |
|image head1|   6       |   0       |   1       |Pixel width                    |
|           |   7       |   1       |   1       |Pixel height                   |
|           |   8       |   2       |   1       |Color palette size or 0        |
|           |   9       |   3       |   1       |Reserved=0                     |
|           |   A       |   4       |   2       |Color planes=0 or 1            |
|           |   C       |   6       |   2       |Bits per Pixel                 |
|           |   E       |   8       |   4       |Image raw size                 |
|           |   12      |   C       |   4       |Offset of imageblock from BOF  |
|image head2|   16      |   0       |   1       |Pixel width                    |
|   ...     |   ...     |   ...     |   ...     |...                            |
|imageblock1|   ...     |   ...     |   ...     |all image data goes here:      |
|           |   ...     |   ...     |   ...     |   pngs included in whole      |
|           |   ...     |   ...     |   ...     |   bmps missing first 14 bytes |

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读