Sha256: e92994d1082ff3a7f21ba027749fcf4505a402f9fbc273a7b3675ace4d57c32e
Contents?: true
Size: 737 Bytes
Versions: 3
Compression:
Stored size: 737 Bytes
Contents
require "RMagick" module RMagickProcessor def image_to_tiff generate_uid tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}.tif").to_s cat = @instance || Magick::Image.read(@source.to_s).first cat.crop!(@x, @y, @w, @h) 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 || Magick::Image.from_blob(blob).first cat.crop!(@x, @y, @w, @h) unless [@x, @y, @w, @h].compact == [] cat.write tmp_file.to_s return tmp_file end def is_a_instance?(object) object.class == Magick::Image end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rtesseract-0.0.13 | lib/processors/rmagick.rb |
rtesseract-0.0.12 | lib/processors/rmagick.rb |
rtesseract-0.0.11 | lib/processors/rmagick.rb |