Sha256: 005b8d2334a82b7d5ca84aa406eaa5ce226e48d2088eaf7ea9ba67b59c79fad4

Contents?: true

Size: 487 Bytes

Versions: 8

Compression:

Stored size: 487 Bytes

Contents

require 'RMagick'

module WGif
  class GifMaker
    def make_gif(frames_dir, filename, dimensions)
      image = Magick::ImageList.new(*frames_dir)
      resize(image, dimensions)
      image.coalesce
      image.optimize_layers Magick::OptimizeLayer
      image.write(filename)
    end

    def resize(image, dimensions)
      image.each do |frame|
        frame.change_geometry(dimensions) do |cols, rows, img|
          img.resize!(cols, rows)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wgif-0.5.4 lib/wgif/gif_maker.rb
wgif-0.5.3 lib/wgif/gif_maker.rb
wgif-0.5.2 lib/wgif/gif_maker.rb
wgif-0.5.1 lib/wgif/gif_maker.rb
wgif-0.5.0 lib/wgif/gif_maker.rb
wgif-0.4.0 lib/wgif/gif_maker.rb
wgif-0.3.1 lib/wgif/gif_maker.rb
wgif-0.3.0 lib/wgif/gif_maker.rb