Why Stage icon so low quality? The original image is much better. How to fix it?
为什么舞台图标质量如此之低?原始图像要好得多。怎么解决?
I used this code to setting image as stage icon:
我使用此代码将图像设置为舞台图标:
stage.getIcons().add(new Image("/res/app_icon.png"));
Screenshot:
Original icon:
1 个解决方案
#1
6
Update
Unfortunately the implementation of the icon chooser in JavaFX 8 does not always choose the best icon size for the application from the list of available icons.
遗憾的是,JavaFX 8中图标选择器的实现并不总是从可用图标列表中为应用程序选择最佳图标大小。
See:
- JDK-8091186 Windows 7 taskbar icon is blurry.
- JDK-8087459 Ugly icon in Windows task bar.
JDK-8091186 Windows 7任务栏图标模糊。
JDK-8087459 Windows任务栏中的丑陋图标。
The issues are (currently) scheduled to be addressed in Java 9.
这些问题(目前)计划在Java 9中解决。
Some comments on those issues are:
对这些问题的一些评论是:
Indeed, Glass currently supports assigning only one icon for a window, it won't allow one to assign a set of differently sized icons. This feature needs to be implemented in Glass.
实际上,Glass目前仅支持为一个窗口分配一个图标,它不允许一个人分配一组不同大小的图标。此功能需要在Glass中实现。
--
I have noticed that when setting multiple icons, only the last one in the list returned by getIcons() is used. It doesn't matter if other icons, with better resolutions are in the list.
我注意到,在设置多个图标时,只使用getIcons()返回的列表中的最后一个图标。如果列表中包含更好分辨率的其他图标则无关紧要。
If you provide a list of icons of different sizes, try putting the size you expect to be used most last in the list (perhaps order the list from smallest to largest or place a 48x48 icon, which is the size used in the quick launch area on Windows 7, as the last or only element in the list). Unfortunately, I do not have access to a Windows machine to test the best icon size for that platform.
如果您提供不同大小的图标列表,请尝试将您希望在列表中最后使用的大小放在最后(可能从最小到最大排序列表或放置48x48图标,这是快速启动区域中使用的大小在Windows 7上,作为列表中的最后一个或唯一的元素)。不幸的是,我无法访问Windows计算机来测试该平台的最佳图标大小。
Icon Guidelines (but be aware of the information in the update above):
图标指南(但请注意上述更新中的信息):
- Provide a set of high quality icons of different sizes to the list returned from
stage.getIcons()
. - The best fit size will be chosen by the runtime.
- Use standard icon sizes which most operating systems can work with without further scaling (for instance item size is a power of two or 48x48).
- Use high quality source images (the original source image in your question seems a bit blurry to me).
- For very small icons, sometimes a pure scale of a larger icon to a smaller size is not best. Sometimes it is best for the icon designer to clean up and remove intricate details from the small icon, which might be OK in a larger icon - see the discussion on icon size on Pushing Pixels to help understand why.
- Info on what icon sizes are used by what OSes is in this icon handbook.
从stage.getIcons()返回的列表中提供一组不同大小的高质量图标。
运行时将选择最佳拟合大小。
使用大多数操作系统可以使用的标准图标大小而无需进一步缩放(例如,项目大小为2或48x48的幂)。
使用高质量的源图像(问题中的原始源图像对我来说似乎有点模糊)。
对于非常小的图标,有时将较大图标的纯粹比例缩小到较小尺寸并不是最佳选择。有时,图标设计师最好清理并从小图标中删除复杂的细节,这可能在较大的图标中可以正常 - 请参阅有关推动像素的图标大小的讨论以帮助理解原因。
有关此图标手册中哪些操作系统使用的图标大小的信息。
stage.getIcons().addAll(
new Image("/res/app_icon64x64.png"),
new Image("/res/app_icon32x32.png"),
new Image("/res/app_icon16x16.png")
);
A great source of high quality icons in a variety of sizes is http://www.iconarchive.com, for example this refresh icon.
http://www.iconarchive.com提供各种尺寸的高质量图标,例如此刷新图标。
#1
6
Update
Unfortunately the implementation of the icon chooser in JavaFX 8 does not always choose the best icon size for the application from the list of available icons.
遗憾的是,JavaFX 8中图标选择器的实现并不总是从可用图标列表中为应用程序选择最佳图标大小。
See:
- JDK-8091186 Windows 7 taskbar icon is blurry.
- JDK-8087459 Ugly icon in Windows task bar.
JDK-8091186 Windows 7任务栏图标模糊。
JDK-8087459 Windows任务栏中的丑陋图标。
The issues are (currently) scheduled to be addressed in Java 9.
这些问题(目前)计划在Java 9中解决。
Some comments on those issues are:
对这些问题的一些评论是:
Indeed, Glass currently supports assigning only one icon for a window, it won't allow one to assign a set of differently sized icons. This feature needs to be implemented in Glass.
实际上,Glass目前仅支持为一个窗口分配一个图标,它不允许一个人分配一组不同大小的图标。此功能需要在Glass中实现。
--
I have noticed that when setting multiple icons, only the last one in the list returned by getIcons() is used. It doesn't matter if other icons, with better resolutions are in the list.
我注意到,在设置多个图标时,只使用getIcons()返回的列表中的最后一个图标。如果列表中包含更好分辨率的其他图标则无关紧要。
If you provide a list of icons of different sizes, try putting the size you expect to be used most last in the list (perhaps order the list from smallest to largest or place a 48x48 icon, which is the size used in the quick launch area on Windows 7, as the last or only element in the list). Unfortunately, I do not have access to a Windows machine to test the best icon size for that platform.
如果您提供不同大小的图标列表,请尝试将您希望在列表中最后使用的大小放在最后(可能从最小到最大排序列表或放置48x48图标,这是快速启动区域中使用的大小在Windows 7上,作为列表中的最后一个或唯一的元素)。不幸的是,我无法访问Windows计算机来测试该平台的最佳图标大小。
Icon Guidelines (but be aware of the information in the update above):
图标指南(但请注意上述更新中的信息):
- Provide a set of high quality icons of different sizes to the list returned from
stage.getIcons()
. - The best fit size will be chosen by the runtime.
- Use standard icon sizes which most operating systems can work with without further scaling (for instance item size is a power of two or 48x48).
- Use high quality source images (the original source image in your question seems a bit blurry to me).
- For very small icons, sometimes a pure scale of a larger icon to a smaller size is not best. Sometimes it is best for the icon designer to clean up and remove intricate details from the small icon, which might be OK in a larger icon - see the discussion on icon size on Pushing Pixels to help understand why.
- Info on what icon sizes are used by what OSes is in this icon handbook.
从stage.getIcons()返回的列表中提供一组不同大小的高质量图标。
运行时将选择最佳拟合大小。
使用大多数操作系统可以使用的标准图标大小而无需进一步缩放(例如,项目大小为2或48x48的幂)。
使用高质量的源图像(问题中的原始源图像对我来说似乎有点模糊)。
对于非常小的图标,有时将较大图标的纯粹比例缩小到较小尺寸并不是最佳选择。有时,图标设计师最好清理并从小图标中删除复杂的细节,这可能在较大的图标中可以正常 - 请参阅有关推动像素的图标大小的讨论以帮助理解原因。
有关此图标手册中哪些操作系统使用的图标大小的信息。
stage.getIcons().addAll(
new Image("/res/app_icon64x64.png"),
new Image("/res/app_icon32x32.png"),
new Image("/res/app_icon16x16.png")
);
A great source of high quality icons in a variety of sizes is http://www.iconarchive.com, for example this refresh icon.
http://www.iconarchive.com提供各种尺寸的高质量图标,例如此刷新图标。