class Lgtmit::Compositer
Constants
- COLOR
- FMT
- GRAV
- POS
- P_SCALE
- TEXT
Attributes
file_name[RW]
image[RW]
Public Class Methods
new(file_name)
click to toggle source
# File lib/lgtmit/compositer.rb, line 14 def initialize(file_name) @file_name = file_name @image = MiniMagick::Image.open(@file_name) end
Public Instance Methods
configure_image!()
click to toggle source
# File lib/lgtmit/compositer.rb, line 24 def configure_image! @image.combine_options do |config| config.fill COLOR config.gravity GRAV config.pointsize p_size_calc config.draw "text #{POS} '#{TEXT}'" end @image.format FMT @image end
run()
click to toggle source
# File lib/lgtmit/compositer.rb, line 19 def run configure_image! write_image! end
write_image!()
click to toggle source
# File lib/lgtmit/compositer.rb, line 35 def write_image! @image.write "#{TEXT}_#{Pathname.new(file_name).basename.to_s}" end
Private Instance Methods
p_size_calc()
click to toggle source
# File lib/lgtmit/compositer.rb, line 41 def p_size_calc if @image[:width] > @image[:height] @image[:width] / P_SCALE else @image[:height] / P_SCALE end end