Commit Graph

169 Commits

Author SHA1 Message Date
Martin Fitzpatrick
735d342608 Add support for HTTP response objects to Image.open()
HTTP response objects returned from `urllib2.urlopen(url)` or
`requests.get(url, stream=True).raw` are 'file-like' but do not
support `.seek()` operations. As a result PIL is unable to
open them as images, requiring a wrap in `cStringIO` or `BytesIO`.

This commit adds this functionality to `Image.open()` by way of
an `.seek(0)` check and catch on exception
`AttributeError` or `io.UnsupportedOperation`. If this is caught
we attempt to wrap the object using `io.BytesIO` (which will
only work on buffer-file-like objects).

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)
2015-03-26 13:25:26 +01:00
wiredfool
d80c27dc3f Merge pull request #1095 from hugovk/pickle_L_mode
Fix pickling L mode images with no palette
2015-01-30 11:39:50 -08:00
hugovk
0f89322216 When unpickling, only put palette if there is one 2015-01-30 14:04:35 +02:00
wiredfool
8c2a7502a4 Correct the name 2015-01-28 10:02:04 -08:00
wiredfool
05fe86654c Added _repr_png method for ipython display hooks 2015-01-28 09:35:31 -08:00
Mikhail Korobov
52cbd123a2 DOC fix "Write Your Own File Decoder" link in Image API docs 2015-01-07 04:12:37 +05:00
homm
806c06f49f use less expensive BICUBIC resampling 2014-12-04 03:30:39 +03:00
homm
43d5d06ce4 rename Image.ANTIALIAS to Image.LANCZOS 2014-11-28 01:41:56 +03:00
wiredfool
e16ee15f2c Merge pull request #997 from homm/replace-resize
Replace resize method
2014-11-27 10:26:48 -08:00
Hugo
0accf25947 Merge pull request #1021 from wiredfool/save-docs
Docs for Image.save [ci skip]
2014-11-20 08:03:15 +02:00
Hugo
3052d4909c Merge pull request #1020 from wiredfool/quantize
Docstring for Image.quantize. [ci skip]
2014-11-20 08:01:10 +02:00
Hugo
2676845e7e Merge pull request #1019 from wiredfool/load-docs
Docs for PyAccess, PixelAccess objects [ci skip]
2014-11-20 07:58:59 +02:00
wiredfool
962ced916d Image.save docs, rename fp, link to params [ci skip] 2014-11-19 15:35:26 -08:00
wiredfool
af8588f34e Docstring for Image.quantize. [ci skip] 2014-11-19 14:26:07 -08:00
wiredfool
ee6f150ef1 Docs for PyAccess, PixelAccess objects [ci skip] 2014-11-19 14:04:39 -08:00
wiredfool
d1f4633c7b Many links to mode concept anchor [ci skip] 2014-11-19 12:49:27 -08:00
wiredfool
b13a90441f Better docs explaining import _imaging failure [ci skip] 2014-11-19 11:42:26 -08:00
homm
f88878c20b reflect changes in documentation 2014-11-09 21:52:16 +03:00
homm
693aff7ee1 remove thumbnail fallback 2014-11-09 21:52:16 +03:00
homm
aba798af25 replace resize implementation 2014-11-09 21:52:16 +03:00
wiredfool
cfbe49f124 Merge pull request #994 from homm/add-transpose
Add transpose and cache aware rotation
2014-11-07 13:58:18 -08:00
homm
32079b1dcc make transpose part of public api 2014-11-07 03:37:12 +03:00
Hugo
8b7a989018 Fix "can can" typo
Closes #971.

[CI skip]
2014-10-25 11:07:34 +03:00
wiredfool
042b809f81 Revert incorrect doc change [ci skip] 2014-10-21 09:57:46 -07:00
Eric Soroos
ba27920838 Fix for regression in scipy 2014-10-04 23:19:30 +00:00
wiredfool
1f377c2ace Merge from master 2014-09-23 09:52:03 -07:00
Hugo
5e676ea0bd Merge remote-tracking branch 'upstream/master' into flake8
Conflicts:
	Tests/bench_cffi_access.py
	Tests/test_file_palm.py
	Tests/test_format_hsv.py
	Tests/test_image_putdata.py
	Tests/test_locale.py
	Tests/test_mode_i16.py
2014-09-23 16:35:20 +03:00
Hugo
91588383e7 Merge pull request #904 from hugovk/hopper3
Replace Lena with Hopper (Part II) & Fix for handling P + transparency -> RGBA conversions
2014-09-20 23:31:59 +03:00
wiredfool
af672b1d7e Fix for handling P + transparency -> RGBA conversions 2014-09-20 10:27:52 -07:00
Jim Garrison
c85e0e915b Image.close() docstring: use correct "its" 2014-09-17 21:36:59 -07:00
hugovk
1de128d6b6 Merge branch 'master' into flake8 2014-09-14 10:23:51 +03:00
Andrew Murray
255a090e97 Avoid resize operation if image is already the correct size 2014-09-10 10:41:46 +10:00
hugovk
bcc5305125 Add access functions for ImagingEffectSpread with a test 2014-09-02 15:53:58 +03:00
hugovk
8c96d38ce9 Add access functions for ImagingEffectMandelbrot with a test 2014-09-02 15:14:00 +03:00
hugovk
860e67e1c4 Add access functions for ImagingEffectNoise with a test 2014-09-02 14:11:08 +03:00
hugovk
1335006cd7 flake8 2014-08-28 14:44:19 +03:00
Eric W. Brown
c97d1a5601 Updates to MPO handler based on review.
Took out the explicit reference to the MPO Plug-in in Image as it’s now
indirectly referenced via the JPEG Plug-in. Removed the direct MPO
Plug-in registration as it’s now shared with the JPEG Plug-in.
Commented on assertion.
2014-07-28 11:14:38 -04:00
Eric W. Brown
8101c2a313 Merge branch 'master' of https://github.com/python-pillow/Pillow 2014-07-25 10:08:18 -04:00
Eric W. Brown
dcd171c1b8 Minor refactoring per discussion and MPO docs. 2014-07-24 11:16:12 -04:00
wiredfool
625ff24358 Storage, packing and access for HSV format images 2014-07-22 16:09:22 -07:00
Eric W. Brown
d5909e4946 Basic MPO reading works, seek is partially there. 2014-07-22 13:31:51 -04:00
Eric W. Brown
5857053be4 Activated MPO detection.
Added MPO to the list to be checked. Removed the superfluous second os
import. Added OS X & Komodo work files to .gitignore.
2014-07-17 12:30:45 -04:00
Eric W. Brown
53b7f6294b First steps toward MPO support.
Allows Pillow to distinguish between JPEGs and MPOs, and provides some
MPO metadata handling. Does not yet handle multiple frames.
2014-07-16 11:36:56 -04:00
Andrew Murray
1aee9bfdef Added class checking to __eq__ function 2014-07-05 23:16:14 +10:00
cgohlke
a5ae40c1b4 Fix AttributeError: class Image has no attribute 'DEBUG' 2014-06-24 22:53:23 -07:00
Hugo
0cd52412b1 Merge pull request #654 from wiredfool/cleanup
Thanks.
2014-06-24 12:16:13 +03:00
hugovk
46abe78b77 Use a custom subclass of RuntimeWarning for DecompressionBombWarning 2014-06-23 10:53:08 +03:00
hugovk
195453679a Merge branch 'master' into bomb
Conflicts:
	PIL/Image.py
2014-06-23 09:51:46 +03:00
Alex Clark
6a79d80374 Revert "Merge pull request #5 from hugovk/unittest1merge"
This reverts commit 0940f0b043, reversing
changes made to 07aa1a56bb.

Conflicts:
	.travis.yml
	test/helper.py
	test/test_imagedraw.py
2014-06-10 07:45:42 -04:00
Ben Williams
9415407b83 Fix a its/it's incorrect usage 2014-06-06 21:42:20 +01:00