ImageMagickをインストールする
brew install imagemagick
sudo apt install imagemagick-6.q16
Noto Sans JPフォントをダウンロードする fonts.google.com
イメージマジック空の画像を生成する
convert -size 1024x128 xc:white bg.png
コマンドを使って画像を生成する
convert -font ./NotoSansJP-Regular.otf -fill black -pointsize 48 -draw "text 1,36 'こんにちは'" bg.png img.png
問題:スクリプトで、「あ」「ん」までのバラバラの画像を生成してみよう
ヒント:
const a = 'あ'.charCodeAt(0); const char = String.fromCharCode(a + i);