Home How to add background to text using MiniMagick::Image
Reply: 0

How to add background to text using MiniMagick::Image

user543
1#
user543 Published in June 19, 2018, 6:29 pm

I'm writing some text on an image with the help of MiniMagick::Image

CODE

image = MiniMagick::Image.open("#{Rails.root}/a.png")

image.combine_options do |c|
  c.fill 'green'
  c.pointsize 20
  c.gravity 'center'
  c.draw "text 0,-110 'Hello I am here'"
  c.draw "text 150,-180 '#{Time.now}"
  c.background 'blue'
end

image.format 'pdf'
image.write("#{Rails.root}/b.pdf")

But, the background doesn't appear

I have referred LINK1 & LINK2

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.573375 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO