图标命令行生成器

Ale*_*sky 4 linux icons command-line

是否有任何适用于 Linux(或其他类 Unix 操作系统)的命令行实用程序可以:

  • 生成一个包含多个图标的 .ico 文件
  • 仅从 1()个 png 或 jpeg 图像开始

例如:

% cool_icon_maker myimage_128x128.png file.ico
Run Code Online (Sandbox Code Playgroud)

file.ico那里会自动将所有的图标大小128×128一样,64×64×64,32×32,16×16等。

Den*_*aia 7

我不知道多合一的解决方案,但我知道可以将两个部分组合在一起:

  • icoutilsicotool,它可以创建/提取 .ico 文件。
  • ImageMagickconvert,它可以将文件转换和调整大小到所需的大小。

所以,这样的事情会起作用(它可能只适用于带有“.png”扩展名的文件):

#!/bin/bash

# Just pass the original .png image as the only parameter to this script.
SOURCE="$1"
BASE=`basename "${SOURCE}" .png`

convert "${SOURCE}" -thumbnail 16x16 "${BASE}_16.png"
convert "${SOURCE}" -thumbnail 32x32 "${BASE}_32.png"
convert "${SOURCE}" -thumbnail 48x48 "${BASE}_48.png"
convert "${SOURCE}" -thumbnail 64x64 "${BASE}_64.png"

icotool -c -o "${BASE}.ico" "${BASE}"_{16,32,48,64}.png

rm -f  "${BASE}"_{16,32,48,64}.png
Run Code Online (Sandbox Code Playgroud)

太丑了,我知道。但它很容易理解,并且有效(我测试过!)。请小心,因为它会在当前目录上创建临时文件,然后将其删除。