Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.