diff --git a/docs/releasenotes/2.8.0.rst b/docs/releasenotes/2.8.0.rst index 5fe485875..85235d72a 100644 --- a/docs/releasenotes/2.8.0.rst +++ b/docs/releasenotes/2.8.0.rst @@ -12,3 +12,11 @@ This allows opening of files using both `urllib2` and `requests`, e.g.:: Image.open(urllib2.urlopen(url)) Image.open(requests.get(url, stream=True).raw) + +If the response uses content-encoding (compression, either gzip or deflate) then this will fail as both the urllib2 and requests raw file object will produce compressed data in that case. Using Content-Encoding on images is rather non-sensical as most images are already compressed, but it can still happen. + +For requests the work-around is to set the decode_content attribute on the raw object to True:: + + response = requests.get(url, stream=True) + response.raw.decode_content = True + image = Image.open(response.raw)