Created
March 13, 2017 12:28
-
-
Save Eric-Guo/486dca564d820f95e0811fe59d0fd856 to your computer and use it in GitHub Desktop.
Using MiniMagick to add text to a picture
This file contains hidden or 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
# encoding: utf-8 | |
require 'mini_magick' | |
image = MiniMagick::Image.open('origin.jpg') | |
image.combine_options do |c| | |
c.font '/Library/Fonts/Songti.ttc' | |
c.pointsize 28 | |
c.gravity 'Center' | |
c.pointsize '22' | |
c.draw "text 3,3 'Ruby语言'" | |
c.fill 'red' | |
end | |
image.write('origin_output.jpg') | |
puts 'ok' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment