Sha256: 2c767bfd93910663093aa8b6a03ec46dec9621ea607073a272ee2f9671930b14

Contents?: true

Size: 640 Bytes

Versions: 12

Compression:

Stored size: 640 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

12 entries across 12 versions & 1 rubygems

Version Path
mork-0.1.3 lib/mork/mimage_list.rb
mork-0.1.2 lib/mork/mimage_list.rb
mork-0.1.1 lib/mork/mimage_list.rb
mork-0.1.0 lib/mork/mimage_list.rb
mork-0.0.12 lib/mork/mimage_list.rb
mork-0.0.11 lib/mork/mimage_list.rb
mork-0.0.10 lib/mork/mimage_list.rb
mork-0.0.9 lib/mork/mimage_list.rb
mork-0.0.8 lib/mork/mimage_list.rb
mork-0.0.7 lib/mork/mimage_list.rb
mork-0.0.6 lib/mork/mimage_list.rb
mork-0.0.5 lib/mork/mimage_list.rb