magick_title
magick_title copied to clipboard
Image with @- text is created for any text
Whatever text I pass as an argument I always get something like this:
> require 'magick_title'
=> true
> MagickTitle.options[:font] = 'Lato-Medium.ttf'
=> "Lato-Medium.ttf"
> MagickTitle.say("Hello!")
=> #<MagickTitle::Image:0x0000000193b6a0 @text="Hello!", @old_path=nil, @options={:root=>"./", :font=>"Lato-Medium.ttf", :font_path=>#<Proc:0x00000001898f18@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:32>, :font_size=>50, :destination=>#<Proc:0x00000001898ef0@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:34>, :extension=>"png", :text_transform=>nil, :width=>800, :height=>nil, :background_color=>"#ffffff", :background_alpha=>"00", :color=>"#68962c", :weight=>400, :kerning=>0, :line_height=>0, :command_path=>nil, :log_command=>false, :cache=>true, :to_html=>{:parent=>{:tag=>"h1", :class=>"image-title"}, :class=>"magick-title"}}, @filename="hello_3a34ca411e95b0bff880e5ee9d730e5efa47ad88.png", @path="./public/system/titles", @url="/system/titles/hello_3a34ca411e95b0bff880e5ee9d730e5efa47ad88.png">
Here are the versions of imagemagick, ruby and magick_title gem that I use.
$ convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ gem list magick_title
*** LOCAL GEMS ***
magick_title (0.2.0)
Does the font exist in the font path?
Yes, the convert call would throw an error otherwise. Something like this:
2.4.1 :002 > MagickTitle.say("Hello!")
convert: unable to read font `./fonts/PermanentMarker.ttf' @ warning/annotate.c/RenderType/872.
=> #<MagickTitle::Image:0x00000002a2d490 @text="Hello!", @old_path=nil, @options={:root=>"./", :font=>"PermanentMarker.ttf", :font_path=>#<Proc:0x00000002a2cfe0@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:32>, :font_size=>50, :destination=>#<Proc:0x00000002a2cfb8@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:34>, :extension=>"png", :text_transform=>nil, :width=>800, :height=>nil, :background_color=>"#ffffff", :background_alpha=>"00", :color=>"#68962c", :weight=>400, :kerning=>0, :line_height=>0, :command_path=>nil, :log_command=>false, :cache=>true, :to_html=>{:parent=>{:tag=>"h1", :class=>"image-title"}, :class=>"magick-title"}}, @filename="hello_44294732cd4f7a3173257d6d4da4a3e1c6d19801.png", @path="./public/system/titles", @url="/system/titles/hello_44294732cd4f7a3173257d6d4da4a3e1c6d19801.png">
Hmm ok.. Does it work without specifying Lato as the font?
Nope, the default font seems to be the PermanentMarker.ttf
and convert can't find it, as I mentioned earlier.
Same issue.