困ってること
https://stackoverflow.com/questions/39764846/imagemagick-best-fit-text-within-rectangle
を参考にしてnodejs
で同じような実装をしたい。
$convert sea.jpg -size 173x50! caption:"A considerably longer text that will result in a smaller font being chosen" -geometry +312+66 -composite result.png
自身の..
const gm = require('gm'); const constant = require('../../shared/constant'); class GM { /** * constructor of Gm */ constructor() { this._gm = gm.subClass({imageMagick: true}); } async test() { this._gm('海の画像') .out('caption:"C considerably longer text that will result in a smaller font being chose A considerably longer text that will result in a smaller font being chosenA considerably longer text that will result in a smaller font being chosen"') .geometry('+0+0') // .composite(APPEAL_IMAGE_PATH) .write('public/images/results/TEXT.png', err => { if(err) {console.log(err)}; }); } } module.exports = GM;
色々やってみましたが、なかなかうまくいきません。ご教授いただけると幸いです。
あなたの回答
tips
プレビュー