ImageMagick e Piping
-
18-09-2019 - |
Domanda
Ho i seguenti comandi che creano uno sprite che contiene uno stato normale e uno stato hover:
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
Sto creando due immagini, top.png e bottom.png le combina per creare test.png.
C'è un modo per farlo senza dover scrivere la parte superiore e inferiore per le immagini disco?
Posso collegare i comandi insieme in qualche modo?
Aggiornamento: Soluzione
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
Soluzione
Questa è completamente non testato, in modo da assicurarsi di eseguire il backup delle immagini rilevanti prima del 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
(questo è chiamato " Sostituzione di processo ")
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow