ImageMagick e Piping
-
18-09-2019 - |
Pergunta
Eu tenho as seguintes comandos que criam um sprite contendo um estado normal e um estado de foco:
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
Estou criando duas imagens, top.png e bottom.png então combiná-las para criar test.png.
Existe uma maneira de fazer isso sem ter que escrever a parte superior e imagens de fundo para o disco?
Can I canalizar os comandos juntos de alguma forma?
Update: Solução
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
Solução
Esta é completamente não testado, por isso certifique-se de fazer backup das imagens relevantes antes de testar:
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
(Isso é chamado de " processo de substituição ")
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow