HomebrewでMacに入れたImagemagickはttfを扱えないのでオプション追加して再インストール

画像に文字を上から書きたかったが、エラーになる。

convert: delegate library support not built-in

Font系がおかしい。調べると、brewで入れたImagemagickはttfを扱えないとのこと。https://github.com/Homebrew/homebrew/issues/16506

そこで入れなおす。

brew install imagemagick --use-tiff

Rubyで連番画像処理するコード

for i in 1..1
  filename = "img" + format("%05d", i) + ".png"
  label = format("%05d", i)
  command = "convert -font '/System/Library/Fonts/Avenir.ttc' -fill yellow -size 2048x1024 -pointsize 100 label:#{label} base.png #{filename}"
  p command
  system(command)
end

It works!