Sha256: a2210ed220a0ebdb8ff8d10911d01b4eafac7262ed8267f998c47870685c88ce
Contents?: true
Size: 803 Bytes
Versions: 3
Compression:
Stored size: 803 Bytes
Contents
require 'mini_magick' module MiniMagickProcessor def image_to_tiff generate_uid tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}.tif").to_s cat = @instance || MiniMagick::Image.open(@source.to_s) cat.format("tif") cat.crop("#{@w}x#{@h}+#{@x}+#{@y}") unless [@x, @y, @w, @h].compact == [] cat.write tmp_file.to_s return tmp_file end def image_from_blob(blob) generate_uid tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}.tif").to_s cat = @instance || MiniMagick::Image.read(blob) cat.format("tif") cat.crop("#{@w}x#{@h}+#{@x}+#{@y}") unless [@x, @y, @w, @h].compact == [] cat.write tmp_file.to_s return tmp_file end def is_a_instance?(object) object.class == MiniMagick::Image end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rtesseract-0.0.13 | lib/processors/mini_magick.rb |
rtesseract-0.0.12 | lib/processors/mini_magick.rb |
rtesseract-0.0.11 | lib/processors/mini_magick.rb |