Skip to content

Commit

Permalink
feat: make the output path customisable and available in benchmark sc…
Browse files Browse the repository at this point in the history
…ript

It is a preparatory step before including output file size in the benchmark
  • Loading branch information
knarewski committed Dec 11, 2024
1 parent 6d82eec commit 742d289
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bin/benchmark-full
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ module Morandi
log " #{image_processor}:"

stats = Hash.new { |hash, key| hash[key] = [] }
output_image_path = "#{input_image_path}-#{image_processor}-output.jpg"
cmd = ['bundle', 'exec',
'/usr/bin/time', '--format', TIME_FORMAT_PARSEABLE,
'bin/process-single', input_image_path, image_processor, options.to_json]
'bin/process-single', input_image_path, image_processor, output_image_path, options.to_json]

ITERATIONS_PER_IMAGE.times do |_i|
stdout_str, _status = Open3.capture2e(*cmd)
Expand Down
6 changes: 3 additions & 3 deletions bin/process-single
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ require 'morandi'

input_file_path = ARGV[0]
processor = ARGV[1]
options_json = ARGV[2]
output_file_path = ARGV[2]
options_json = ARGV[3]

options = options_json ? JSON.parse(options_json) : { 'straighten' => 0.5, 'gamma' => 0.85 }
output_path = "#{input_file_path}-#{processor}-output.jpg"

Morandi.process(input_file_path, options, output_path, 'processor' => processor)
Morandi.process(input_file_path, options, output_file_path, 'processor' => processor)

0 comments on commit 742d289

Please sign in to comment.