2009-07-21 20 views
3

Ich habe folgende Befehle, die ein Sprite, die einen normalen Zustand und einen Hover-Zustand zu erstellen:ImageMagick und Piping

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 

Ich erstelle zwei Bilder, top.png und bottom.png kombiniert sie dann erstellen test.png.

Gibt es eine Möglichkeit, dies zu tun, ohne die oberen und unteren Bilder auf Disc zu schreiben?

Kann ich die Befehle zusammen einige wie?

Update: Lösung

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 

Antwort

4

Dies ist vollständig ungetestet, so stellen Sie sicher, dass die entsprechenden Bilder vor dem Test-Backup:

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 

(Das nennt man "Process Substitution")

+0

Nach ein bisschen Basteln, habe ich es geschafft zu arbeiten: montage \ <(convert -background none -pointsize 11 -fill weiss -size 100x -gravitation NorthWest beschreibung: 'Test' png :-) \ <(convert -background none -pointsize 11 -fill grey -groesse 100x - Gravitation SouthWest Bildunterschrift: 'Test' png :-) \ -geometrie + 0 + 0 -file 1x2 -background keine test.png Der ursprüngliche Code, den du gepostet hast, hat die Bilder noch auf Disc geschrieben, aber das scheint zu funktionieren. Hurra! –

+0

Ausgezeichnet. Ich habe meine Antwort entsprechend aktualisiert. –