mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-23 07:44:37 +03:00
Merge pull request #1151 from mfitzp/open-http-image
Add support for HTTP response objects to Image.open()
This commit is contained in:
commit
aaa26f316a
|
@ -109,6 +109,7 @@ from PIL._util import deferred_error
|
|||
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
|
||||
# type stuff
|
||||
import collections
|
||||
|
@ -2248,6 +2249,11 @@ def open(fp, mode="r"):
|
|||
else:
|
||||
filename = ""
|
||||
|
||||
try:
|
||||
fp.seek(0)
|
||||
except (AttributeError, io.UnsupportedOperation):
|
||||
fp = io.BytesIO(fp.read())
|
||||
|
||||
prefix = fp.read(16)
|
||||
|
||||
preinit()
|
||||
|
|
Loading…
Reference in New Issue
Block a user