Sha256: 4b146440fdec94be8338935c0b58c66945490a20514b925b5352601c1c204f5c
Contents?: true
Size: 1.23 KB
Versions: 6
Compression:
Stored size: 1.23 KB
Contents
module Riiif class File attr_reader :path class_attribute :info_extractor_class self.info_extractor_class = ImageMagickInfoExtractor # @param input_path [String] The location of an image file def initialize(input_path, tempfile = nil) @path = input_path @tempfile = tempfile # ensures that the tempfile will stick around until this file is garbage collected. end def self.read(stream, ext) create(ext) do |f| while chunk = stream.read(8192) f.write(chunk) end end end def self.create(ext = nil, _validate = true, &block) tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase]) tempfile.binmode block.call(tempfile) tempfile.close image = new(tempfile.path, tempfile) ensure tempfile.close if tempfile end # @param [Transformation] transformation def extract(transformation) command = command_factory.build(path, transformation) execute(command) end def info @info ||= info_extractor_class.new(path).extract end delegate :execute, to: Riiif::CommandRunner private :execute private def command_factory ImagemagickCommandFactory end end end
Version data entries
6 entries across 6 versions & 1 rubygems