如何在ImageMagick中以角度方向书写文字? [英] How to write text with angle orientation in ImageMagick?

查看:796
本文介绍了如何在ImageMagick中以角度方向书写文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Web字体在图像上以特定的角度方向写入一些文本,我应该使用哪个命令?
猜它是一个从左下角到右上角的文本。



这里是需要定位的工作示例代码:

  convert -size 600x357 xc:none -drawimage Over 0,0 0,0'background01.jpg'\ 
-pointsize 30 -fontgeometricslab703bt-bold-webfont.ttf-fill White \
-drawtext 140,175'mijn ideale' - append + repage \
result.jpg


解决方案

您需要将TTF字体文件复制到您的ImageMagick安装路径正在寻找字体。对我来说,那是 / usr / X11 / share / fonts / TTF /





< pre class =lang-sh prettyprint-override> sudo cp -p geoslab703-xbd-bt-extra-bold.ttf \
/ usr / X11 / share / fonts / TTF / geoslab703-xbd-bt-extra-bold.ttf

您可以验证字体是否可用通过运行识别实用程序。

 识别 - 列表字体

只需搜索您的字体

 字体:GeoSlab703-XBd-BT-Extra-Bold 
系列:GeoSlab703 XBd BT
样式:正常
stretch:正常
体重:400
字形:/usr/X11/share/fonts/TTF/geoslab703-xbd-bt-extra-bold.ttf



以某个角度显示



我建议你在一个单一的文本处理code> -draw 命令



convert -size 600x357 xc:none -drawimage Over 0,0 0,0'background01.jpg'\
-draw font GeoSlab703-XBd-BT-Extra-Bold font-size 30 fill white \
rotate -15 text 140,165'mijn ideale'\
-append + repage result.jpg

更多示例@ 文字处理用法


is it possible to use web fonts to write some text over the image with a particular angle orientation, and which command should I use? Guess it for example a text going from a left bottom corner to the right top corner.

Here the working example code, that needs to be orientated:

convert -size 600x357 xc:none -draw "image Over 0,0 0,0 'background01.jpg'" \
        -pointsize 30 -font "geometricslab703bt-bold-webfont.ttf" -fill White \
        -draw "text 140,175 'mijn ideale'" -append +repage \
         result.jpg

解决方案

You'll need to copy your TTF font file into a path your ImageMagick install is looking for fonts. For me, that's /usr/X11/share/fonts/TTF/.

sudo cp -p geoslab703-xbd-bt-extra-bold.ttf \
           /usr/X11/share/fonts/TTF/geoslab703-xbd-bt-extra-bold.ttf

You can verify that the font is available to you by running the identify utility.

identify -list font

And simply search for your font

  Font: GeoSlab703-XBd-BT-Extra-Bold
    family: GeoSlab703 XBd BT
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: /usr/X11/share/fonts/TTF/geoslab703-xbd-bt-extra-bold.ttf

For displaying at an angle

I would suggest doing all your text handling within a single -draw command

convert -size 600x357 xc:none -draw "image Over 0,0 0,0 'background01.jpg'" \
  -draw "font GeoSlab703-XBd-BT-Extra-Bold font-size 30 fill white \
         rotate -15 text 140,165 'mijn ideale'" \
  -append +repage result.jpg

More examples @ Text Handling Usage

这篇关于如何在ImageMagick中以角度方向书写文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆