Sha256: a1d01db6c9cb847be6a65441403fcd8fdb156c5e83eb109c87e2bd693005ff7d
Contents?: true
Size: 772 Bytes
Versions: 1
Compression:
Stored size: 772 Bytes
Contents
# encoding: UTF-8 # Add to rtesseract a image manipulation with QuickMagick module QuickMagickProcessor def self.setup require 'quick_magick' end def self.a_name?(name) %w(quick_magick QuickMagickProcessor).include?(name.to_s) end def self.image_to_tif(source, x = nil, y = nil, w = nil, h = nil) tmp_file = Tempfile.new(['', '.tif']) cat = source.is_a?(Pathname) ? read_with_processor(source.to_s) : source cat.compress = 'None' cat.format = 'tif' cat.crop("#{w}x#{h}+#{x}+#{y}") unless [x, y, w, h].compact == [] cat.write tmp_file.path.to_s tmp_file end def self.read_with_processor(path) QuickMagick::Image.read(path.to_s).first end def self.image?(object) object.class == QuickMagick::Image end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rtesseract-1.2.0 | lib/processors/quick_magick.rb |