Created
March 13, 2017 17:22
-
-
Save Eric-Guo/a30e9bbe2bfeabf9c9597a192aec9d0a to your computer and use it in GitHub Desktop.
Add Chinese text and logo as overlay picture via mini_magick
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 38 | |
c.draw "text 360,145 'Ruby语言'" | |
c.fill 'red' | |
end | |
outimage = image.composite(MiniMagick::Image.open('overlay.jpg')) do |c| | |
c.compose 'Over' | |
c.geometry '+246+90' | |
end | |
outimage.write('origin_output.jpg') | |
puts 'ok' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment