Home » Misc » Some examples of Imagemagick convert

Some examples of Imagemagick convert

Adding Chinese text to a image

Adding English text should be very straightforward, just by using the following command

convert -antialias -font fontname  -fill blue -pointsize 36 -draw "text 15,50 'text'" in.jpg out.png 

However adding Chinese text needs a further consideration. The fontname should be a Chinese font name, which, if not work by just type in its name say WenQuanYi, should be substituted by its full path within single quotation marks, e.g. '/usr/share/fonts/wenquanyi/wqy-zenhei/wqy-zenhei.ttc'. The path of the font can be queried by

 fc-list 

Merging two images

convert img_top.png -page +120+10 img_bottom.png -flatten out.png

+120+10 specified the position (+right+down) of img_top.png on img_bottom.png.

Converting CSV to other formats

A library called librcsv should be needed. Install it before executing the following command

convert -size 48x48 -transparent in.svg out.png 

The 48×48 specifies the size of the png file in pixels.

— Last modified: xiaoke 2014/07/20 01:17