Sha256: df95cab175f5d7a670b6dac5afb88df72c96ee52d1f9e34d5cb54ae21a9961db

Contents?: true

Size: 491 Bytes

Versions: 2

Compression:

Stored size: 491 Bytes

Contents

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")
    cat.crop("#{@w}x#{@h}+#{@x}+#{@y}") unless [@x, @y, @w, @h].compact == []
    cat.write tmp_file.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.1 lib/processors/mini_magick.rb
rtesseract-1.0.0 lib/processors/mini_magick.rb