Question

Due to the performance advantages of Minimagick of Rmagick (and the fact the Rmagik is on the way out) I would like to be able to able to perform the following operation in Minimagick. By default it seems that Minimagick does not handle unicode character well, but Rmagick has no roblem at all (this code works fine):

def getimage
      bg = Magick::ImageList.new("#{Rails.root}/app/assets/images/template.png")
      text = Magick::Draw.new
      text.encoding = "Unicode"
      text.text(23,14,"ÿüñCe#43535r(*&^%$#ð")
      text.draw(bg)
   send_data(bg.to_blob, :type => 'image/png', :disposition => 'inline')
end
Was it helpful?

Solution

I'm still struggling to understand what exactly does work for you and what doesn't, and where your actual problem is....

Nevertheless, my first stab into the fog is this. Swap the following two lines:

  text.text(23,14,"ÿüñCe#43535r(*&^%$#ð")
  text.draw(bg)

and make them read this:

  text.draw(bg)
  text.text(23,14,"ÿüñCe#43535r(*&^%$#ð")

That is: first draw the background, then draw the text. (Minimagick most likely executes the drawing statements in the stated order, because the commandline's behavior is the same -- and Minimagick is only a wrapper around the commandline...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top