class Despeck::Commands::DespeckAndOcr

Subcommand that removes watermarks & returns OCR text

Public Instance Methods

execute() click to toggle source
# 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