Sha256: 7dd6b456536db75b252267cb3d186e5525953c6ebe2e70705d38e6c09b792419

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 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)
      Mimage.new @images[i]
    end
    
    def each
      @images.each do |i|
        yield Mimage.new i
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mork-0.0.2 lib/mork/mimage_list.rb