Sha256: f9e061094089c3c5a4166c951915ef664b9b12ebe3406ae99d5f8f5c7d411b7f

Contents?: true

Size: 521 Bytes

Versions: 4

Compression:

Stored size: 521 Bytes

Contents

# encoding: UTF-8
require "RMagick"
module RMagickProcessor
  extend self
  def image_to_tiff
    tmp_file = Tempfile.new(["",".tif"])
    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.path.to_s){self.compression = Magick::NoCompression}
    return tmp_file
  end

  def read_with_processor(path)
    Magick::Image.read(path.to_s).first
  end

  def is_a_instance?(object)
    object.class == Magick::Image
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtesseract-1.0.5 lib/processors/rmagick.rb
rtesseract-1.0.4 lib/processors/rmagick.rb
rtesseract-1.0.3 lib/processors/rmagick.rb
rtesseract-1.0.2 lib/processors/rmagick.rb