2009-07-21 6 views
3

je les commandes suivantes qui créent une image-objet contenant un état normal et un état de vol stationnaire:ImageMagick et tuyauterie

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 

Je crée deux images, top.png et bottom.png puis les combiner pour créer test.png.

Y at-il un moyen de le faire sans avoir à écrire les images du haut et du bas sur le disque?

Puis-je canaliser les commandes ensemble comment?

Mise à jour: 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 

Répondre

4

Ceci est complètement non testé, alors assurez-vous de sauvegarder les images pertinentes avant le test:

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 

(Ceci est appelé "Process Substitution")

+0

Après un peu de bricolage, j'ai réussi à faire fonctionner ceci: montage \ <(convertir -background aucun -pointsize 11 -fill blanc -size 100x -gravity Légende NorthWest: 'Test' png :-) \ <(convert -background aucun -pointsize 11 -fill gray -size 100x - Gravity Légende de SouthWest: 'Test' png :-) \ -geometry + 0 + 0 -tile 1x2 -background none test.png Le code original que vous avez posté a quand même écrit les images sur le disque, mais cela semble fonctionner. Hoorah! –

+0

Excellent. J'ai mis à jour ma réponse en conséquence. –

Questions connexes