Use qualified PIL.Image, not just Image.
This commit is contained in:
parent
c01a7c9d9d
commit
0de20a34c9
3 changed files with 9 additions and 11 deletions
4
crop.py
4
crop.py
|
@ -1,13 +1,13 @@
|
|||
import argparse
|
||||
import os
|
||||
from PIL import Image
|
||||
import PIL.Image
|
||||
import sys
|
||||
|
||||
from voussoirkit import pipeable
|
||||
from voussoirkit import winglob
|
||||
|
||||
def crop(filename, crops, *, inplace=False):
|
||||
image = Image.open(filename)
|
||||
image = PIL.Image.open(filename)
|
||||
if len(crops) == 2:
|
||||
crops.extend(image.size)
|
||||
|
||||
|
|
|
@ -86,15 +86,13 @@
|
|||
# |________|______________|_______________________________________________________|
|
||||
|
||||
import os
|
||||
import PIL.Image
|
||||
import sys
|
||||
from PIL import Image
|
||||
|
||||
|
||||
ICO_HEADER_LENGTH = 6
|
||||
ICON_DIRECTORY_ENTRY_LENGTH = 16
|
||||
BMP_HEADER_LENGTH = 40
|
||||
|
||||
|
||||
def chunk_sequence(sequence, chunk_length, allow_incomplete=True):
|
||||
'''
|
||||
Given a sequence, divide it into sequences of length `chunk_length`.
|
||||
|
@ -135,10 +133,10 @@ def little(x, length):
|
|||
return x.to_bytes(length, byteorder='little')
|
||||
|
||||
def load_image(filename):
|
||||
image = Image.open(filename)
|
||||
image = PIL.Image.open(filename)
|
||||
if min(image.size) > 256:
|
||||
(w, h) = image.size
|
||||
image = image.resize(fit_into_bounds(w, h, 256, 256), resample=Image.ANTIALIAS)
|
||||
image = image.resize(fit_into_bounds(w, h, 256, 256), resample=PIL.Image.ANTIALIAS)
|
||||
image = image.convert('RGBA')
|
||||
return image
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import argparse
|
||||
import os
|
||||
from PIL import Image
|
||||
import PIL.Image
|
||||
import sys
|
||||
|
||||
from voussoirkit import imagetools
|
||||
|
@ -23,7 +23,7 @@ def resize(
|
|||
quality=100,
|
||||
):
|
||||
file = pathclass.Path(filename)
|
||||
image = Image.open(file.absolute_path)
|
||||
image = PIL.Image.open(file.absolute_path)
|
||||
|
||||
(image_width, image_height) = image.size
|
||||
|
||||
|
@ -52,9 +52,9 @@ def resize(
|
|||
|
||||
log.debug('Resizing %s to %dx%d.', file.absolute_path, new_x, new_y)
|
||||
if nearest_neighbor:
|
||||
image = image.resize( (new_x, new_y), Image.NEAREST)
|
||||
image = image.resize( (new_x, new_y), PIL.Image.NEAREST)
|
||||
else:
|
||||
image = image.resize( (new_x, new_y), Image.ANTIALIAS)
|
||||
image = image.resize( (new_x, new_y), PIL.Image.ANTIALIAS)
|
||||
|
||||
if inplace:
|
||||
new_name = file
|
||||
|
|
Loading…
Reference in a new issue