ImageMagick:为什么这个文字不会扩展填充? [英] ImageMagick: Why won't this text expand to fill?

查看:99
本文介绍了ImageMagick:为什么这个文字不会扩展填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读

< p >





解决方案

您的命令适合我一次更正。显然,即使我添加了-respect-parenthesis,pointize也会从你的主命令泄漏到括号处理中。所以解决方案是在括号命令中添加+ pointsize。这是我的命令和结果。

  magick -respect-parenthesis -size 298x248 canvas:white \('arrows.png' -resize 300x \)-gravity northwest -geometry + 0 + 140 -compose over -composite -bordercolor'#cccccc' -border 1 -font Arial -fill red -pointsize 22 -gravity north -annotate + 0 + 4'** ***********************'-font Arial -fill red -pointsize 22 -gravity north -annotate + 0 + 68' ******* ******************'-font Arial -fill green -pointsize 15 -gravity south -annotate + 0 + 64'hvac.com'\(-size 279x55 + pointsize -background green -fill blue -font ArialB -gravity center caption:'test headline'\)-gravity center -geometry + 0-82 -compose over -composite output.png 



请注意,我将arrows.png文件放在可以在与发出命令的位置相同的级别访问它。你可以改变它的路径。




I'm reading the text handling docs for label and it seems if I specify -size it should magically get as big as possible to fill the space.

I want to make it so this text gets as big as possible. I will set the \n characters myself in the title (if absolutely necessary).

I'd rather the \n get calculated automatically, but it seems label is what makes it the biggest possible (but doesn't support automatic \n), while caption will add \n where appropriate (but doesn't support a dynamic size which fills to fit a space).

My goal is to basically get the BIGGEST possible text, whether it's on 1 line or 3, to fit in the green box (between the 2 red ****** lines).

Below are 2 examples of how it won't change. The green color is just temporary so I can debug.

Heres my code for this text piece (without all the rest):

-size 290x54 -background green -fill blue -font ArialB -gravity center label:'Join Us'

Multiline...

-size 290x54 -background green -fill blue -font ArialB -gravity center label:'Join Us Tomorrow\nFor An HVAC Meeting'

I don't know if this is possible, but ideally it should ask "if the title is on 1 line, what is the max size it could be? if I put a \n after word 1, what is the max size it could be? if i put a \n after word 2, what is the max size it could be?"... and then choosing the largest of those.

解决方案

Your command works for me with one correction. Apparently, the pointsize leaks from the your main command into the parenthesis processing, even though I added -respect-parenthesis. So the solution is to add +pointsize into the parenthesis command. Here is my command and result.

magick -respect-parenthesis -size 298x248 canvas:white \( 'arrows.png' -resize 300x \) -gravity northwest -geometry +0+140 -compose over -composite -bordercolor '#cccccc' -border 1 -font Arial -fill red -pointsize 22 -gravity north -annotate +0+4 '*************************' -font Arial -fill red -pointsize 22 -gravity north -annotate +0+68 '*************************' -font Arial -fill green -pointsize 15 -gravity south -annotate +0+64 'hvac.com' \( -size 279x55 +pointsize -background green -fill blue -font ArialB -gravity center caption:'test headline' \) -gravity center -geometry +0-82 -compose over -composite  output.png


Note that I put the arrows.png file where I could access it at the same level as where the command is being issued. You can change the path to it.

这篇关于ImageMagick:为什么这个文字不会扩展填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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