Module: MiniMagickProcessor

Extended by:
MiniMagickProcessor
Included in:
MiniMagickProcessor
Defined in:
lib/processors/mini_magick.rb

Instance Method Summary collapse

Instance Method Details

#image_to_tiffObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/processors/mini_magick.rb', line 5

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

#is_a_instance?(object) ⇒ Boolean

Returns:



20
21
22
# File 'lib/processors/mini_magick.rb', line 20

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

#read_with_processor(path) ⇒ Object



16
17
18
# File 'lib/processors/mini_magick.rb', line 16

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