class Emojimage::CLI

Public Instance Methods

cast(image) click to toggle source

CLI option to convert and save image.

# File lib/emojimage/cli.rb, line 14
def cast(image)
        c = []
        for comp in options['blend']
                c << comp.to_i
        end
        if c.length == 1
                color = ChunkyPNG::Color.rgb(c[0], c[0], c[0])
        elsif c.length == 3
                color = ChunkyPNG::Color.rgb(c[0], c[1], c[2])
        else
                raise "Bad RGB in blend option"
        end
        spell = Emojimage::Converted.new image, options['size']
        spell.run options['transparency'], color
        spell.save options['output'], options['type'].to_sym, options['wrap']
end