-
Notifications
You must be signed in to change notification settings - Fork 62
-
Hey there!
I'm new here. I've been playing around with vips to generate images and I'm having super fun to be honest. I've ported all I had from imagemagick and it's loading way faster, so I'm pretty happy with that.
However, I'm getting this error when trying this annotate example if I change the text left corner
by left & corner
, in the 7th line.:
/Users/tavo/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips/operation.rb:228:in `build': text: invalid markup in text (Vips::Error)
from /Users/tavo/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips/operation.rb:483:in `call'
from /Users/tavo/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips/image.rb:234:in `method_missing'
from test.rb:7:in `<main>'
As you can see in those logs, I'm running ruby 3.1.2 and ruby-vips 2.1.4 (vips-8.12.2)
Do I need to scape or encode or something that parameter?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions
Hi @luctus,
The text operator supports pango markup, so yes, you need eg. &
. You'll need to escape <
and >
as well.
https://docs.gtk.org/Pango/pango_markup.html
https://www.libvips.org/2021/06/04/What's-new-in-8.11.html#full-colour-text-rendering
Replies: 2 comments
-
Hi @luctus,
The text operator supports pango markup, so yes, you need eg. &
. You'll need to escape <
and >
as well.
https://docs.gtk.org/Pango/pango_markup.html
https://www.libvips.org/2021/06/04/What's-new-in-8.11.html#full-colour-text-rendering
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks a lot, @jcupitt !
So, just to confirm... instead of this:
left_text = Vips::Image.text "left & corner", dpi: 300
I should be using this:
left_text = Vips::Image.text CGI.escapeHTML("left & corner"), dpi: 300
I just tested it and it worked ;)
Beta Was this translation helpful? Give feedback.