Skip to content

Instantly share code, notes, and snippets.

@ken1flan
Created July 18, 2016 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ken1flan/1b168955d6e2d4374d1d5fbb4fa7721f to your computer and use it in GitHub Desktop.
Save ken1flan/1b168955d6e2d4374d1d5fbb4fa7721f to your computer and use it in GitHub Desktop.
require "mini_magick"
puts 'Hello, minimagick'
text = "じゅげむじゅげむ ごこうのすりきれ かいじゃりすいぎょのすいぎょうまつうんらいまつふうらいまつ くうねるところにすむところ やぶらこうじのぶらこうじ ぱいぽぱいぽぱいぽのしゅーりんがん しゅーりんがんのぐーりんだい ぐーりんだいのぽんぽこぴーのぽんぽこなのちょうきゅうめいのちょうすけ"
image = MiniMagick::Image.open('sample.png')
image.resize "300x300"
image.combine_options do |c|
c.gravity 'Center'
#c.pointsize '22'
c.font 'fonts/NotoSansCJKjp-Black.otf'
c.fill 'white'
#c.draw "text 0,0 'にゃんと'"
c.draw "text 0,0 '#{text}'"
c.stroke 'gray'
end
image.format "png"
image.write "output.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment