Sha256: 2d498c56bba84622447110d2ccf8c77f84d4aa06e850e04cb44198ff8db8c474
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Gif2lgtm module Main module_function def start(image_path) gif = compsite!(image_path) create!(gif, image_path) end def compsite!(image_path) gif = Magick::ImageList.new images = Magick::ImageList.new(image_path) original_size_lgtm = Magick::ImageList.new('images/lgtm.png') lgtm = original_size_lgtm.resize_to_fit(images.first.columns, images.first.rows) images.each do |image| blob = Magick::Image.from_blob(image.to_blob)[0] image = blob.composite( lgtm, Magick::CenterGravity, Magick::OverCompositeOp ) gif.push(image) end gif end def create!(gif, image_path) gif.iterations = 0 random = SecureRandom.hex(5) dir_path = File.dirname(image_path) result_path = "#{dir_path}/lgtm_#{random}_#{File.basename(image_path)}" gif.optimize_layers(Magick::OptimizeLayer).write(result_path) puts <<~MESSAGE ======================================================= Lgtm created. path: #{result_path} ======================================================= MESSAGE end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gif2lgtm-1.0.0 | lib/gif2lgtm/main.rb |