Best way to write alpha channel multi-line text over image
Posted: 2013-03-09T13:38:17-07:00
Goals... In the case where 1000s of these pipelines run simultaneously...
1) Single command, no intermediate files
2) Must handle multi-line images, hence label rather than draw
3) Text image must have alpha channel, so background image shows through
4) Least load on CPU + intermediate memory
5) Final image must be a .jpg
I'd rather use draw, except draw fails to convert "\n". If there's a way to have draw correctly render "\n", let me know.
Seems like there'd be less memory used if the size didn't have to be specified in the first convert and this was the only way I could get this working.
Here's one version of this pipeline that works... and it's a bit slow...
convert -size 1563x2500 -transparent white -font URW-Palladio-L-Bold-Italic -pointsize 100 -gravity center -fill purple 'label:this is a test' png:- |\
composite -size 1563x2500 -compose dstover -gravity center -geometry +0+0 back.png - png:- |\
convert - output.jpg
Gurus, any suggestions as to how I might refine this pipeline?
Thanks.
1) Single command, no intermediate files
2) Must handle multi-line images, hence label rather than draw
3) Text image must have alpha channel, so background image shows through
4) Least load on CPU + intermediate memory
5) Final image must be a .jpg
I'd rather use draw, except draw fails to convert "\n". If there's a way to have draw correctly render "\n", let me know.
Seems like there'd be less memory used if the size didn't have to be specified in the first convert and this was the only way I could get this working.
Here's one version of this pipeline that works... and it's a bit slow...
convert -size 1563x2500 -transparent white -font URW-Palladio-L-Bold-Italic -pointsize 100 -gravity center -fill purple 'label:this is a test' png:- |\
composite -size 1563x2500 -compose dstover -gravity center -geometry +0+0 back.png - png:- |\
convert - output.jpg
Gurus, any suggestions as to how I might refine this pipeline?
Thanks.