将文本转换为图像 [英] Convering Text to Image

查看:99
本文介绍了将文本转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将给定文本(比如TEST)转换为不同字体和样式的图像。

I want to convert given text, say TEST, to image in different font and style.

我正在使用Imagemagick的转换命令

I am using Imagemagick's convert command

convert -pointsize 120  -font Courier label:'TEST' test.png

但当我使用 -style 同样,它不会变成不同的样式,如Normal,Bold,Italic。

But when I am using -style in the same, it is not changing into different style like Normal, Bold, Italic.

请建议如何获得所有3种款式。

Please suggest how to get all 3 style.

谢谢,
Ravi

Thanks, Ravi

推荐答案

我想 -style (例如 Italic )和 -weight (例如 Bold )仅适用于某些字体,例如postscript(虽然无法引用您的确定来源)。

I think -style (e.g. Italic) and -weight (e.g. Bold) only work for certain fonts like postscript ones (unable to quote you a definitive source though).

我是什么使用的字体如 Courier-New-Bold Courier-New-Italic Courier-新粗体斜体
例如:

What I use is fonts like Courier-New-Bold, Courier-New-Italic, Courier-New-Bold-Italic. e.g.:

convert -pointsize 120 -font Courier label:'TEST' test.png
convert -pointsize 120 -font Courier-New-Bold label:'TEST' testbold.png
convert -pointsize 120 -font Courier-New-Italic label:'TEST' testitalic.png
convert -pointsize 120 -font Courier-New-Bold-Italic label:'TEST' testbolditalic.png

大多数字体都有 -Bold -Italic -Bold-Italic 版本。
要查看可以使用的字体,请执行 convert -list font (或 convert -list type if你的ImageMagick更老了)。我做 convert -list font | grep字体:获取只是字体名称的精简列表。

Most fonts have the -Bold, -Italic, and -Bold-Italic versions. To see what fonts you can use, do convert -list font (or convert -list type if your ImageMagick is older). I do convert -list font | grep Font: to get a condensed list of just font names.

这篇关于将文本转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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