问题描述
通过阅读有关文字的
但是在Ubuntu 16.04 LTS上,相同的命令不起作用,使用 convert
版本:ImageMagick 6.8.9-9 Q16 x86_64 2016-06-01。事实上,它实际上是渲染stdin算子。
我唯一能够在Google上远程查找这个问题的内容是,可追溯到2015年10月,其中修补了ImageMagick 6.9.2-5 Beta修复类似问题。
问题:我没有正确地逃避它,是否在ImageMagick中确实存在问题,或者我的Linux发行版是否收到了带有错误的ImageMagick的历史版本,我需要?
许多实验后很久
已解决......?已建立ImageMa从Ubuntu框上的源代码中获取gick 7.0.2,上面的命令可以正常工作。有没有更好的解决方案?
无需从源代码构建。只需用`tee`替换@ - :
printfHello \\\
World|
兑换\
-size 1280x100 \
-background'#0000FF10'\
-density 90 \
-gravity Center \
-fill black \
-font Helvetica \
标题:`tee`\
test.png
`tee`将在完成转换命令之前先执行'process'stdin。
My understanding from reading the ImageMagick documentation regarding text, is that the @-
notation reads the contents of standard input.
As such, this should be a fairly straight forward way to render Hello World.
printf "Hello\nWorld" |
convert \
-size 1280x100 \
-background '#0000FF10' \
-density 90 \
-gravity Center \
-fill black \
-font Helvetica \
caption:@- \
test.png
On OS X 10.11.5 via HomeBrew, this works, using convert
Version: ImageMagick 6.9.4-3 Q16 x86_64 2016-05-20.
However on Ubuntu 16.04 LTS, the identical command does not work, using convert
Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-06-01. In fact, it renders the stdin operator, literally.
The only thing I was able to find that remotely looked like this problem on Google was this article, dated back in Oct 2015 in which ImageMagick 6.9.2-5 Beta was patched to fix a similar problem.
QUESTION: Am I not escaping it properly, is there really a problem in ImageMagick, or is my Linux Distro picking up a historical version of ImageMagick with the bug and I need to build from source?
Much Later After Many Experiments
SOLVED ...? Built ImageMagick 7.0.2 from source on the Ubuntu box and the above command worked as desired. Was there a better solution?
No need to build from source. Just replace @- with "`tee`" :
printf "Hello\nWorld" |
convert \
-size 1280x100 \
-background '#0000FF10' \
-density 90 \
-gravity Center \
-fill black \
-font Helvetica \
caption:"`tee`" \
test.png
`tee` will execute first and 'process' stdin before completing the convert command.
这篇关于如何在ImageMagick中使用带标题的标准输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!