imagick php中的垂直文本

imagick php中的垂直文本,php,imagick,vertical-text,Php,Imagick,Vertical Text,我希望文本在imagick图像中垂直显示 例如,我有“测试”文本,但我想要这样的文本: test 你知道吗? 谢谢。哦!我知道你在要求一个PHP解决方案。我不会删除它,而是保留它,因为它可能对将来可能正在寻找命令行版本的其他人有用 由于似乎没有人想为您制作PHP版本,这里有一种方法应该可以工作——目前只需使用伪代码: create empty output image with transparent background for each letter in the string do

我希望文本在imagick图像中垂直显示

例如,我有“测试”文本,但我想要这样的文本:

t
e
s
t

你知道吗?
谢谢。

哦!我知道你在要求一个PHP解决方案。我不会删除它,而是保留它,因为它可能对将来可能正在寻找命令行版本的其他人有用

由于似乎没有人想为您制作PHP版本,这里有一种方法应该可以工作——目前只需使用伪代码:

create empty output image with transparent background
for each letter in the string do
   create a new transparent image larger than necessary
   use annotateImage() to draw single letter on transparent image
   use trimImage() to get rid of superfluous space around image
   repage image with setImagePage(0, 0, 0, 0) 
   add a small transparent border around the image so letters don't touch - use borderImage()
   append this image to vertical stack with appendImages(true)
done

你可以做这样的事,尽管它很难看

printf "Vertical" | perl -pe 's/(.)/\1\n/g' |
   convert -background cyan -fill magenta -pointsize 36 -gravity center label:@- result.gif


我只是在
Perl
部分中用一个换行符替换每个字符,然后将其导入到
convert
命令中,
标签@-
stdin

读取它。我想在imagick php的帮助下垂直执行此文本。我现在没有时间创建php版本,但在我的答案中添加了一些伪代码和提示,应该可以让您开始。希望这有帮助。这对我们没有帮助。为什么?你是什么意思?因为我想用php垂直显示图像文本。