iconutil error: "Unsupported image format"
iconutil error: "Unsupported image format"
我一直在尝试使用 iconutil 从文件夹 "folderthumb.iconset" 中的 .png 图像生成 .icns 图标,使用以下命令:
iconutil -c icns folderthumb.iconset
当源 png 具有 alpha 透明度时一切顺利。但是,当 PNG 不透明时(来自 sips,hasAlpha=no)iconutil returns 错误:
Unsuported image format
我的libpng是v1.6,用brew
安装。
有没有关于如何解决这个问题的提示?
旧版本的 iconutil 不要求 png 文件有 alpha 通道,分发的 iconutil 版本是 OS X 10.11(或者是最近的 Xcode?我'我不确定...) 确实如此。
如果您有带透明部分的图标,这应该没问题,因为我希望所有图形工具在导出为 png 时都包含 Alpha 通道。但是,如果您有一个完全不透明的图标,大多数工具和应用程序在导出为 png 时会删除 alpha 通道。
这是我解决这个问题的方法:我安装了 ImageMagick(例如通过 Mac OS 端口),然后使用 ImageMagick 的命令行工具 convert
添加 alpha 通道并设置颜色 space 到 sRGB(由 iconutil 推荐):
convert input.png -alpha Set -colorspace sRGB -define png:format=png32 output.png
如果您对 iconset 文件夹中的所有图标执行此操作,iconutil 应该不再 return 错误。
我一直在尝试使用 iconutil 从文件夹 "folderthumb.iconset" 中的 .png 图像生成 .icns 图标,使用以下命令:
iconutil -c icns folderthumb.iconset
当源 png 具有 alpha 透明度时一切顺利。但是,当 PNG 不透明时(来自 sips,hasAlpha=no)iconutil returns 错误:
Unsuported image format
我的libpng是v1.6,用brew
安装。
有没有关于如何解决这个问题的提示?
旧版本的 iconutil 不要求 png 文件有 alpha 通道,分发的 iconutil 版本是 OS X 10.11(或者是最近的 Xcode?我'我不确定...) 确实如此。
如果您有带透明部分的图标,这应该没问题,因为我希望所有图形工具在导出为 png 时都包含 Alpha 通道。但是,如果您有一个完全不透明的图标,大多数工具和应用程序在导出为 png 时会删除 alpha 通道。
这是我解决这个问题的方法:我安装了 ImageMagick(例如通过 Mac OS 端口),然后使用 ImageMagick 的命令行工具 convert
添加 alpha 通道并设置颜色 space 到 sRGB(由 iconutil 推荐):
convert input.png -alpha Set -colorspace sRGB -define png:format=png32 output.png
如果您对 iconset 文件夹中的所有图标执行此操作,iconutil 应该不再 return 错误。