ImageMagick 和管道
我有以下命令来创建包含正常状态和悬停状态的精灵:
convert -background none -pointsize 11 -fill white -size 100x -gravity NorthWest caption:'Test' top.png
convert -background none -pointsize 11 -fill grey -size 100x -gravity SouthWest caption:'Test' bottom.png
montage top.png bottom.png -geometry +0+0 -tile 1x2 -background none test.png
我正在创建两个图像,top.png 和bottom.png,然后将它们组合起来创建test.png。
有没有办法做到这一点而无需将顶部和底部图像写入光盘?
我可以通过某种方式将命令连接在一起吗?
更新:解决方案
montage \
<(convert -background none -pointsize 11 -fill white -size 100x -gravity NorthWest caption:'Test' png:-) \
<(convert -background none -pointsize 11 -fill grey -size 100x -gravity SouthWest caption:'Test' png:-) \
-geometry +0+0 -tile 1x2 -background none test.png
I have the following commands that create a sprite containing a normal state and a hover state:
convert -background none -pointsize 11 -fill white -size 100x -gravity NorthWest caption:'Test' top.png
convert -background none -pointsize 11 -fill grey -size 100x -gravity SouthWest caption:'Test' bottom.png
montage top.png bottom.png -geometry +0+0 -tile 1x2 -background none test.png
I'm creating two images, top.png and bottom.png then combining them to create test.png.
Is there a way to do this without having to write the top and bottom images to disc?
Can I pipe the commands together some how?
Update: Solution
montage \
<(convert -background none -pointsize 11 -fill white -size 100x -gravity NorthWest caption:'Test' png:-) \
<(convert -background none -pointsize 11 -fill grey -size 100x -gravity SouthWest caption:'Test' png:-) \
-geometry +0+0 -tile 1x2 -background none test.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是完全未经测试的,因此请确保在测试之前备份相关图像:(
这称为“进程替换")
This is completely untested, so make sure to backup the relevant images before testing:
(This is called "Process Substitution")