Sha256: 5586c26af4461aed028b98d34676b78f9a2d3df8845b8c8cac86be3e4ccf6ec9
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
module Gif2lgtm module Main module_function LOOP_COUNT = 0 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("#{Dir.pwd}/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 = LOOP_COUNT 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.4 | lib/gif2lgtm/main.rb |