From ab24374041b4f40f430780ff2f47f7b93c9db671 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 29 Oct 2023 12:14:33 -0700 Subject: [PATCH] Convert 1-bit images to grayscale to stop aliasing. --- resize.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resize.py b/resize.py index 113ce75..74f317a 100644 --- a/resize.py +++ b/resize.py @@ -106,6 +106,10 @@ def resize( log.debug('Resizing %s to %dx%d.', file.absolute_path, width, height) resampler = PIL.Image.NEAREST if nearest_neighbor else PIL.Image.LANCZOS + + if image.mode == '1': + image = image.convert('L') + image = image.resize( (width, height), resampler) if output_file.extension == '.jpg':