Skip to content

Instantly share code, notes, and snippets.

@seyhunak
Created September 9, 2013 13:30
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seyhunak/6495608 to your computer and use it in GitHub Desktop.
Save seyhunak/6495608 to your computer and use it in GitHub Desktop.
How to add a text caption to an image with MiniMagick and Ruby
require 'rubygems'
require 'mini_magick'
img = MiniMagick::Image.from_file("jpeg.jpg")
img.combine_options do |c|
c.gravity 'Southwest'
c.draw 'text 10,10 "whatever"'
c.font '-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-2'
c.fill("#FFFFFF")
end
img.write("new.jpg")
@ragar90
Copy link

ragar90 commented Jul 18, 2022

what does the font means?? and how do I change font size??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment