1
0
mirror of https://github.com/django/django.git synced 2025-10-27 23:56:08 +00:00

Removed PIL compatability layer per deprecation timeline.

refs #19934.
This commit is contained in:
Tim Graham
2014-03-21 10:54:53 -04:00
parent 6d1ae5e27c
commit 4965a77407
15 changed files with 48 additions and 211 deletions

View File

@@ -1,7 +1,7 @@
"""
Utility functions for handling images.
Requires Pillow (or PIL), as you might imagine.
Requires Pillow as you might imagine.
"""
import zlib
@@ -35,9 +35,9 @@ def get_image_dimensions(file_or_path, close=False):
'close' to True to close the file at the end if it is initially in an open
state.
"""
from django.utils.image import ImageFile as PILImageFile
from PIL import ImageFile as PillowImageFile
p = PILImageFile.Parser()
p = PillowImageFile.Parser()
if hasattr(file_or_path, 'read'):
file = file_or_path
file_pos = file.tell()
@@ -46,9 +46,9 @@ def get_image_dimensions(file_or_path, close=False):
file = open(file_or_path, 'rb')
close = True
try:
# Most of the time PIL only needs a small chunk to parse the image and
# get the dimensions, but with some TIFF files PIL needs to parse the
# whole file.
# Most of the time Pillow only needs a small chunk to parse the image
# and get the dimensions, but with some TIFF files Pillow needs to
# parse the whole file.
chunk_size = 1024
while 1:
data = file.read(chunk_size)