# File lib/mini_magick.rb, line 62 def read(stream, ext = nil) if stream.is_a?(String) stream = StringIO.new(stream) elsif stream.is_a?(File) if File.respond_to?(:binread) stream = StringIO.new File.binread(stream.path.to_s) else stream = StringIO.new File.open(stream.path.to_s,"rb") { |f| f.read } end end create(ext) do |f| while chunk = stream.read(8192) f.write(chunk) end end end