Browse Source

Handling deprecation of ANTIALIAS by Pillow (fixes #1119).

pull/1131/head
Matthew Petroff 2 years ago
parent
commit
7d42e49d10
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      utils/multires/generate.py

+ 4
- 2
utils/multires/generate.py View File

@@ -51,6 +51,8 @@ except KeyError:
# Handle case of PATH not being set
nona = None

# Handle Pillow deprecation
ANTIALIAS = Image.Resampling.LANCZOS if hasattr(Image, "Resampling") else Image.ANTIALIAS

genPreview = False
try:
@@ -251,7 +253,7 @@ for f in range(0, 6):
os.makedirs(os.path.join(args.output, str(level)))
tiles = int(math.ceil(float(size) / tileSize))
if (level < levels):
face = face.resize([size, size], Image.ANTIALIAS)
face = face.resize([size, size], ANTIALIAS)
for i in range(0, tiles):
for j in range(0, tiles):
left = j * tileSize
@@ -284,7 +286,7 @@ if args.fallbackSize > 0:
background = Image.new(face.mode[:-1], face.size, colorTuple)
background.paste(face, face.split()[-1])
face = background
face = face.resize([args.fallbackSize, args.fallbackSize], Image.ANTIALIAS)
face = face.resize([args.fallbackSize, args.fallbackSize], ANTIALIAS)
face.save(os.path.join(args.output, 'fallback', faceLetters[f] + extension), quality = args.quality)

# Clean up temporary files


Loading…
Cancel
Save