Class: Despeck::Commands::DespeckAndOcr

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/commands/despeck_and_ocr.rb

Overview

Subcommand that removes watermarks & returns OCR text

Instance Method Summary collapse

Instance Method Details

#executeObject



14
15
16
17
18
19
20
# File 'lib/commands/despeck_and_ocr.rb', line 14

def execute
  extension = File.extname(input_file)
  temp_image = Tempfile.new(['despecked', extension])
  `bundle exec despeck remove #{input_file} #{temp_image.path}`
  input_image = temp_image.size.zero? ? input_file : temp_image.path
  puts `bundle exec despeck ocr -l #{lang} #{input_image}`
end