Module: MiniMagickProcessor

Defined in:
lib/processors/mini_magick.rb

Instance Method Summary collapse

Instance Method Details

#image_to_tiffObject



3
4
5
6
7
8
9
10
11
# File 'lib/processors/mini_magick.rb', line 3

def image_to_tiff
  generate_uid
  tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}.tif").to_s
  cat = MiniMagick::Image.open(@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