如何使用 ImageMagick 将图标连接成单个图像?

发布于 2024-07-04 10:57:00 字数 219 浏览 6 评论 0原文

我想在网站上使用 CSS sprite 而不是单独的图像文件,以获取大量小图标它们的尺寸都相同。 如何使用 ImageMagick 将它们连接(平铺)成一张大图像?

I want to use CSS sprites on a web site instead of separate image files, for a large collection of small icons that are all the same size. How can I concatenate (tile) them into one big image using ImageMagick?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

但可醉心 2024-07-11 10:57:01

您正在寻找:

montage -background transparent -geometry +4+4 *.png sprite.gif

You are looking for:

montage -background transparent -geometry +4+4 *.png sprite.gif
风情万种。 2024-07-11 10:57:01

从您链接的页面中,'montage' 是您想要的工具。 它将获取一堆图像并将它们连接/平铺为单个输出。 这是我在使用该工具之前制作的示例图像:
替代文本
(来源:davr.org

From the page you linked, 'montage' is the tool you want. It'll take a bunch of images and concatenate/tile them into a single output. Here's an example image I've made before using the tool:
alt text
(source: davr.org)

汹涌人海 2024-07-11 10:57:00

转换比蒙太奇效果好得多。 它垂直或水平排列图像并保持 png 透明度。

convert *.png -append sprites.png (append vertically)
convert *.png +append sprites.png (append horizontally)

convert works much better than montage. It arranges images vertically or horizontally and keeps png transparency.

convert *.png -append sprites.png (append vertically)
convert *.png +append sprites.png (append horizontally)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文