Tuesday, April 3, 2018

convert text to image

1- with libre office

$ soffice --convert-to jpg textfile.txt

2- with imagemagick

-from file
$ convert -size 1920x1080 -fill black -strokewidth 2 -stroke red -font Verdana -density 96 -pointsize 56 caption:@textfile.txt out.png

if there's error check policy /etc/ImageMagick-6/policy.xml and comment out one policy like below

  <!-- in order to avoid to get image with password text -->
<!--  <policy domain="path" rights="none" pattern="@*"/> -->

-from stdout

$ ifconfig |convert -size 1920x1080 -fill black -strokewidth 2 -stroke red -font Verdana -density 96 -pointsize 56 caption:@- out.png

-with border
$ ifconfig |convert -size 1920x1080 -fill black -strokewidth 0.7  -stroke black -font cour.ttf  -gravity west -border 10x20 -density 128 -background '#e6e6e6' -bordercolor '#e6e6e6' -interline-spacing 1.5  caption:@- out.png

No comments:

Post a Comment