Created
July 18, 2016 22:48
-
-
Save ken1flan/1b168955d6e2d4374d1d5fbb4fa7721f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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