4

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
4

1 回答 1

5

这是完全未经测试的,因此请确保在测试前备份相关图像:

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

(这称为“过程替换”)

于 2009-07-21T14:23:20.820 回答