imagemagick - write text and change image width -


how can change width of image depending on width of text?

if want 5 pixel padding both left , right of text?

and how can define path font want use?

  1. 'how change width of image depending on width of text?'

    you can use biiiig drawing canvas first , -trim trim superfluous space around text. example:

    convert                                         \    -font "courier"                              \    -size 800x200                                \     xc:none                                     \    -box green                                   \    -pointsize 24                                \    -gravity center                              \    -draw "text 0,0 'this clarkk\'s text...'" \    -trim                                        \     clarkk.jpeg 
  2. 'how add 5 pixels padding both left , right of text?'

    you can use of different imagemagick methods add left , right pixels resulting image step 1. example:

     convert                                                   \     clarkk.jpeg                                            \    -gravity center                                         \    -extent $(identify -format '%[fx:w+10]x%h' clarkk.jpeg) \     clarkk-padded.jpeg 
  3. 'how define path of font want use?'

    you can use -font "/path/to/some directory with/fontname.ttf" directive.

    convert                                         \    -font "/library/fonts/verdana italic.ttf"    \    -size 800x200                                \     xc:none                                     \    -box green                                   \    -pointsize 24                                \    -gravity center                              \    -draw "text 0,0 'this clarkk\'s text...'" \    -trim                                        \     clarkk-font.jpeg 

    to list of fonts accessible imagemagick, run

    convert -list font 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -