lib/processors/rmagick.rb in rtesseract-1.3.3 vs lib/processors/rmagick.rb in rtesseract-2.0.0

- old
+ new

@@ -11,18 +11,18 @@ def self.a_name?(name) %w(rmagick RMagickProcessor).include?(name.to_s) end - def self.image_to_tif(source, x = nil, y = nil, w = nil, h = nil) + def self.image_to_tif(source, _points = {}) tmp_file = Tempfile.new(['', '.tif']) cat = source.is_a?(Pathname) ? read_with_processor(source.to_s) : source - cat.crop!(x, y, w, h) unless [x, y, w, h].compact == [] + cat.crop!(_points[:x], _points[:y], _points[:w], _points[:h]) if _points.is_a?(Hash) && _points.values.compact != [] cat.alpha Magick::DeactivateAlphaChannel - cat.write(tmp_file.path.to_s) { + cat.write(tmp_file.path.to_s) do # self.depth = 16 self.compression = Magick::NoCompression - } + end tmp_file end def self.read_with_processor(path) Magick::Image.read(path.to_s).first