Convert 1-bit images to grayscale to stop aliasing.
This commit is contained in:
parent
80c390653f
commit
ab24374041
1 changed files with 4 additions and 0 deletions
|
@ -106,6 +106,10 @@ def resize(
|
||||||
|
|
||||||
log.debug('Resizing %s to %dx%d.', file.absolute_path, width, height)
|
log.debug('Resizing %s to %dx%d.', file.absolute_path, width, height)
|
||||||
resampler = PIL.Image.NEAREST if nearest_neighbor else PIL.Image.LANCZOS
|
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)
|
image = image.resize( (width, height), resampler)
|
||||||
|
|
||||||
if output_file.extension == '.jpg':
|
if output_file.extension == '.jpg':
|
||||||
|
|
Loading…
Reference in a new issue