Sha256: 6743ccac5872f8ae86c918dbc29c4cca608daa8c03f67b0d4951073d6827d6cd

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

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