Sha256: 44cbcc1b620cb0b4c0b98d0d2ca4e05d15d6886d43209956f1d84a4d52e74adf

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

# encoding: UTF-8
require 'mini_magick'
module MiniMagickProcessor
  extend self
  def image_to_tiff
    tmp_file = Tempfile.new(["",".tif"])
    cat = @instance || read_with_processor(@source.to_s)
    cat.format("tif") do |c|
      c.compress "None"
    end
    cat.crop("#{@w}x#{@h}+#{@x}+#{@y}") unless [@x, @y, @w, @h].compact == []
    cat.write tmp_file.path.to_s
    return tmp_file
  end

  def read_with_processor(path)
    MiniMagick::Image.open(path.to_s)
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rtesseract-1.0.5 lib/processors/mini_magick.rb
rtesseract-1.0.4 lib/processors/mini_magick.rb