diff --git a/crop.py b/crop.py index ac1eee5..ff3ed80 100644 --- a/crop.py +++ b/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) diff --git a/icoconvert.py b/icoconvert.py index 0740c4b..77a2915 100644 --- a/icoconvert.py +++ b/icoconvert.py @@ -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 diff --git a/resize.py b/resize.py index 9e69001..9f48c31 100644 --- a/resize.py +++ b/resize.py @@ -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