使用 ImageMagick 将图像组合成一行

发布于 2024-12-09 13:42:25 字数 419 浏览 2 评论 0原文

我有大约 650 个带有精灵的 gif 文件,但我无法在 中显示它们的动画,因此我需要将它们转换为精灵表,每个动画转换为单个 png

很明显为什么我不想和 Gimp 一起手工完成这一切。我找到了一种将 gif 的帧提取到单个文件中的方法:

convert image.gif -depth 32 /tmp/frames%02d.png

非常简单,但我遇到了一个问题:现在我想制作一个 png 出来其中,排成一排。我怎样才能正确地组合它们?

如果有人能帮助我那就太好了。

编辑:我自己发现了如何保持透明度。

I have about 650 gif files with sprites, but I can't display them animated in a <canvas>, so I would need to turn them into spritesheets, every animation into a single png.

It's obvious why I don't want to do all this by hand with Gimp. I have found a way to extract the frames of the gif into individual files:

convert image.gif -depth 32 /tmp/frames%02d.png

Very simple, but I am stuck with a problem: Now I want to make a single png out of them, in one row. How can I compose them correctly?

It'd be great if anyone could help me.

EDIT: Found out how to preserve transparency myself.

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

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

发布评论

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

评论(1

等往事风中吹 2024-12-16 13:42:25

秘密在于 -append 选项:

convert +append frame*.png sprite.png

效果很好。

The secret is the -append option:

convert +append frame*.png sprite.png

Works nicely.

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