Sha256: 8fd2f354b653bb7f92b48b5c91170ed5b4fbb09ed1ca268541a175e44f632ee5

Contents?: true

Size: 642 Bytes

Versions: 8

Compression:

Stored size: 642 Bytes

Contents

# require 'RMagick'

module Mork
  # The class MimageList
  class MimageList
    def initialize(fname)
      raise "Initializing a MimageList requires a string" unless fname.class == String
      if File.extname(fname) == '.pdf'
        @images = Magick::ImageList.new(fname) { self.density = 200 }
      else
        @images = Magick::ImageList.new(fname)
      end
    end
    
    def shift
      Mimage.new @images.shift
    end
    
    def [] (i)
      # puts "I: #{i}"
      # puts @images[i].inspect
      Mimage.new @images[i]
    end
    
    def each
      @images.each do |i|
        yield Mimage.new i
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mork-0.8.1 lib/mork/mimage_list.rb
mork-0.8.0 lib/mork/mimage_list.rb
mork-0.7.0 lib/mork/mimage_list.rb
mork-0.6.0 lib/mork/mimage_list.rb
mork-0.5.0 lib/mork/mimage_list.rb
mork-0.4.0 lib/mork/mimage_list.rb
mork-0.3.0 lib/mork/mimage_list.rb
mork-0.2.1 lib/mork/mimage_list.rb