Fix for saving to io.BytesIO()

This commit is contained in:
Martin Fergie 2014-11-14 12:29:10 +00:00
parent 9da99dee8d
commit dd3a46520c

View File

@ -1128,8 +1128,12 @@ def _save(im, fp, filename):
print (ifd.items())
_fp = 0
if hasattr(fp, "fileno"):
fp.seek(0)
_fp = os.dup(fp.fileno())
import io
try:
fp.seek(0)
_fp = os.dup(fp.fileno())
except io.UnsupportedOperation:
pass
# ICC Profile crashes.
blocklist = [STRIPOFFSETS, STRIPBYTECOUNTS, ROWSPERSTRIP, ICCPROFILE]