问题描述
我正在尝试使用 the gm package 在 GIF 顶部叠加文本。它确实将文本覆盖在常规图像之上,但是在 GIF 上,它只覆盖了最后 2 帧。我没有太多使用这个包和 Imagemagick 的经验。
这是编辑图像的代码。
gm(request(image)) //any image url
.command('convert')
.coalesce()
.font("./impact.ttf")
.dither(false)
.fontSize(Math.round(width/11)) //Width is defined earlier in the code
.stroke("#000000")
.strokeWidth(width/450)
.out('-gravity','north')
.out('-size',width+'x','-fill','white','-background','transparent','0')
.out('caption:' + meme[0].toupperCase().substr(meme[0].indexOf(" ")+1))
.out('-layers','optimize')
.out('-gravity','south')
.out('-size','caption:' + meme[1].toupperCase())
.out('-layers','optimize')
.strip()
// If i use these two,it does append all the layers but the text does not wrap like it does using caption
// .drawText(0,1,meme[0].toupperCase().substr(meme[0].indexOf(" ") + 1),'north')
// .drawText(0,meme[1].toupperCase(),'South')
.stream((error,stdout) => {...}
任何帮助将不胜感激!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)