Skip to content

Commit

Permalink
bug fix for single file optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
victordomingos committed Jun 24, 2018
1 parent baf0091 commit d110143
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions optimize-images.py
Expand Up @@ -162,7 +162,7 @@ def get_args(*args):
if args.max_width < 0 or args.max_height < 0:
msg = "\nPlease specify image dimensions as positive integers.\n\n"
parser.exit(status=0, message=msg)

return src_path, recursive, quality, args.reduce_colors, args.max_colors, args.max_width, args.max_height, args.keep_exif


Expand Down Expand Up @@ -449,16 +449,14 @@ def main(*args):
# Optimize a single image
elif os.path.isfile(src_path):
found_files += 1
img, format, orig_mode, result_mode, orig_colors, final_colors, orig_size, \
final_size, was_optimized = do_optimization((src_path, quality, reduce_colors, max_colors, keep_exif, has_exif))
img, format, orig_mode, result_mode, orig_colors, final_colors, orig_size, final_size, was_optimized, was_downsized, had_exif, has_exif = do_optimization((src_path, quality, reduce_colors, max_colors, max_w, max_h, keep_exif))
total_src_size = orig_size
if was_optimized:
optimized_files = 1
total_bytes_saved = total_bytes_saved + (orig_size - final_size)
show_file_status(img, format, orig_mode, result_mode, orig_colors, final_colors, orig_size, final_size,
was_optimized, had_exif, has_exif,
line_width)

was_optimized, was_downsized, had_exif, has_exif,
line_width)
else:
print("No image files were found. Please enter a valid path to the "
"image file or the folder containing any images to be processed.")
Expand Down

0 comments on commit d110143

Please sign in to comment.