Commit Graph

351 Commits

Author SHA1 Message Date
matt
53c9a80d1b Changed equals method on Image so it short circuits. Also put getpalette() and tobytes() comparison at the end because they are the slowest operations. 2016-06-19 17:44:24 -04:00
Andrew Murray
86828ffd2a Replaced del with pop 2016-06-18 11:25:39 +10:00
homm
78242e4acd remove stale comment 2016-06-08 16:47:26 +03:00
homm
3d622d60cf make perspecive transform arguments order more common 2016-06-08 16:17:41 +03:00
homm
2b77b1cec7 make affine transform arguments order more common 2016-06-08 16:17:41 +03:00
homm
6be3df2a43 remove internal ImagingTransform from headers
rename to ImagingGenericTransform
2016-06-08 16:17:41 +03:00
homm
1f8c2527ba internal rotating functions not used anymore 2016-06-08 16:17:41 +03:00
homm
709078efd1 use one self.transform for rotation 2016-06-08 16:17:41 +03:00
homm
7687ce829e round results of sin and cos functions because there is no possible
float-point value of radians which cos will exactly 0.
2016-06-08 16:17:41 +03:00
homm
8203a43d26 Fast paths for rotation 2016-06-08 16:17:41 +03:00
homm
f680b5417b one code style for all methods 2016-06-08 16:17:41 +03:00
wiredfool
3657bc10a6 Merge pull request #1889 from rr-/libpngquant
Add libimagequant support in quantize()
2016-05-26 21:12:25 +01:00
homm
c4b92d09b7 support for La mode 2016-05-26 15:15:08 +03:00
Andrew Murray
da83f9f1d0 Removed support for list form of Image info 2016-05-07 18:33:02 +10:00
rr-
eb354be7c4 Add method=Image.LIBIMAGEQUANT for quantize() 2016-05-05 21:39:16 +02:00
wiredfool
8b9b996327 Merge pull request #1862 from daniel-leicht/fix-generic-use-of-exception
Deprecated function will no longer raise "Exception" but "NotImplementedError".
2016-05-05 16:32:05 +01:00
Andrew Murray
41b4f1fd81 Corrected Image show documentation 2016-05-05 19:30:07 +10:00
Pierrick Koch
272588feca [PIL] Image add support _MODE_CONV LA mode 2016-04-29 21:03:24 +01:00
Pierrick Koch
001bee40ab [PIL] Image add support fromarray LA mode
fix:

>>> img = np.zeros((40,40,2), 'uint8')
>>> Image.fromarray(img)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1929, in fromarray
    raise TypeError("Cannot handle this data type")
TypeError: Cannot handle this data type
2016-04-27 15:23:44 +02:00
daniel
1f4e2a180b Changed the use of the generic "Exception" to "NotImplementedError" in the deprecated functions. 2016-04-27 11:12:57 +03:00
Andrew Murray
bb0d312de7 Added __copy__ method to Image 2016-03-16 20:23:51 +11:00
wiredfool
fb853267f9 Merge pull request #1748 from radarhere/path
Fixed bug when saving to a non-existent path using pathlib
2016-03-14 09:48:53 -07:00
wiredfool
c3bf1e1c78 Merge pull request #1745 from hugovk/crop_integers
Round crop's arguments to nearest integers
2016-03-14 09:44:29 -07:00
wiredfool
b1f6cecd70 Merge pull request #1663 from wiredfool/uninitialized-variable
Fixes uninitialized variable warning in _imaging.c:getink
2016-03-14 09:41:12 -07:00
wiredfool
10f2faf3ed Provide a more general error check to catch #1753 2016-03-08 01:04:11 -08:00
Andrew Murray
b959a25f09 Fixed bug when saving to a non-existent path using pathlib 2016-02-27 13:10:50 +11:00
hugovk
239f09435a Round crop args to nearest integers (#1744) 2016-02-24 15:11:08 +02:00
wiredfool
27d8edbed5 Merge pull request #1728 from radarhere/buffer
Updated documentation s/fromstring/frombytes
2016-02-23 14:29:57 -08:00
Andrew Murray
46bd536c0c Corrected documentation reference [ci skip] 2016-02-19 20:11:00 +11:00
Andrew Murray
7bfb2745cb Updated documentation [ci skip] 2016-02-14 21:02:38 +11:00
Andrew Murray
3a55a20712 Improved alpha_composite documentation 2016-02-01 21:02:43 +11:00
Andrew Murray
a5b2c4da29 Corrected comment 2016-01-31 11:57:02 +11:00
wiredfool
a098c88509 Convert was passing in a 3tuple to putpixel for a P image 2016-01-14 08:58:13 -08:00
wiredfool
436daee5e0 Merge pull request #1591 from radarhere/health
Health fixes
2015-12-14 21:00:09 +00:00
wiredfool
65ff8f9f5a Merge pull request #1578 from cartisan/numpy-conversion-for-hsv
Enabled conversion to numpy array for HSV images. #1559
2015-12-14 20:55:47 +00:00
Andrew Murray
c27110ab56 Flake8 fixes 2015-12-10 21:34:02 +11:00
Andrew Murray
5f904ace9d Removed warnings check 2015-12-09 16:55:33 +11:00
cartisan
8b76f557ce Enabled conversion to numpy array for HSV images. #1559 2015-12-07 17:40:42 +00:00
Andrew Murray
82c7ea8489 Changed string format argument to logger parameter 2015-12-02 16:32:44 +11:00
mattip
0ff05afa56 test, fix missing 'version' key value in __array_interface__ 2015-11-02 20:07:12 +02:00
wiredfool
b7501aa3c0 Merge pull request #1490 from wiredfool/pr1470
Reqorded Pr #1470
2015-10-12 07:28:40 -07:00
wiredfool
d8a6a8cc18 Reworded warning 2015-10-12 07:26:58 -07:00
Andrew Murray
6bd7e7f02d Removed trailing whitespace 2015-10-11 21:24:35 +11:00
masklinn
fc52f73366 Add warning to tobytes
It probably isn't what most developers want.
2015-10-05 12:27:25 +02:00
wiredfool
42633d7a31 spaces. 2015-10-03 08:29:52 +01:00
wiredfool
d965257616 Fix handling of pathlib in save. Fixes #1460 2015-10-03 08:12:44 +01:00
wiredfool
89ccf66ff7 Merge pull request #1343 from radarhere/deprecated
Removed deprecated code
2015-09-29 15:38:34 +01:00
wiredfool
2350eaad17 Merge pull request #1423 from wiredfool/debug-logging
Removing spammy debug logging
2015-09-20 10:32:47 +01:00
Andrew Murray
71c95c8e5f Restored deprecated methods with errors instead 2015-09-19 21:36:19 +10:00
Andrew Murray
baa5143394 Removed methods deprecated in 2.0 2015-09-19 21:06:12 +10:00
wiredfool
5b7f6f2638 Fix docs to match code, see http://engineering.khanacademy.org/posts/making-thumbnails-fast.htm 2015-09-15 01:00:36 -07:00
wiredfool
43f3e7504c Removing spammy debug logging 2015-09-14 03:42:08 -07:00
Andrew Murray
105e963505 Flake8 fixes 2015-09-11 19:28:19 +10:00
wiredfool
9cbbab2da5 Dedup code in image.open 2015-09-10 07:17:40 -07:00
Hugo van Kemenade
d66f9eb7ea Merge pull request #1373 from radarhere/rotate
Fix fast rotate operations
2015-08-09 11:26:51 +03:00
Andrew Murray
e271471f8e Flake8 fix 2015-08-06 00:24:08 +10:00
Andrew Murray
f6d11a2803 Only use fast rotate operations if the expand flag is in use or the image is square 2015-08-06 00:23:14 +10:00
Andrew Murray
7775ff3ac7 Updated docstrings 2015-08-05 22:32:15 +10:00
Andrew Murray
457d39832d Added support for pathlib Path objects to open and save 2015-08-05 20:54:33 +10:00
Ömer Kala
1b8b2dbf33 Update Image.py 2015-07-12 17:42:55 +03:00
Alex Clark
67d1541c6f Merge pull request #1207 from anntzer/logger
Use logging instead of print.
2015-07-02 05:22:07 -04:00
Andrew Murray
abe25b7191 Rearranged format handler fetching 2015-07-01 09:19:28 +10:00
Andrew Murray
2c4fe7281f Merged gifmaker into GifImagePlugin 2015-06-30 18:02:48 +10:00
Antony Lee
983c4602b5 Also log plugin opening failures.
This allows obtaining tracebacks of failures by plugins to open files by
setting the log-level to DEBUG, rather than by having to uncomment the
"traceback.print_exc" lines in Image.open.
2015-06-29 12:39:50 -07:00
Antony Lee
4e754e9c55 Use logging instead of print.
cf. #1191.

Only TiffImagePlugin and OLEFileIO still rely on (their own) DEBUG flag.
I left TiffImagePlugin as it is because I hope #1059 gets merged in
first, and OLEFileIO because it uses its own logic.

Untested, as usual.
2015-06-29 12:39:50 -07:00
Andrew Murray
afa4cadb23 Added width and height properties 2015-06-26 17:20:17 +10:00
Andrew Murray
b553ad7a70 Further fixes 2015-06-21 16:33:55 +10:00
Andrew Murray
c644bf9455 Do not import ImageQt until it is requested 2015-06-19 15:55:35 +10:00
Roman Inflianskas
2d706d74dc add functions to convert: Image <-> QImage; Image <-> QPixmap (see #897) 2015-06-18 11:21:14 +10:00
wiredfool
9abedaab1d Merge pull request #1248 from radarhere/health
Further health fixes
2015-06-16 11:54:03 -07:00
wiredfool
30631902d6 Merge pull request #1231 from radarhere/image_palette
Copy image when saving in GifImagePlugin
2015-06-16 11:49:41 -07:00
Andrew Murray
26bcc443d1 Specified exception types 2015-05-30 09:18:27 +10:00
Andrew Murray
a996033079 Fixed various typos 2015-05-29 14:59:54 +10:00
Andrew Murray
3c7e37d2d7 Replaced old-style classes 2015-05-27 00:07:21 +10:00
Andrew Murray
b1e8a68df8 When copying Image, copy ImagePalette as well 2015-05-14 09:57:56 +10:00
Hugo
f21b45c976 Merge pull request #1184 from darkfeline/add-doc
Clarify docstring about mask values [ci skip]
2015-05-05 19:29:04 +03:00
Andrew Murray
d1c182cadc Various Flake8 fixes 2015-04-24 09:26:52 +10:00
Allen Li
e8107e3bbb Remove wrong docstring about RGBA paste [ci skip]
Pasting RGBA images does preserve the alpha channel if the current image
has an alpha channel.
2015-04-10 23:25:15 -04:00
Allen Li
c6d410ff3b Correct description of alpha-composite [ci skip] 2015-04-10 23:24:30 -04:00
Allen Li
7674694185 Correct description of paste() behavior [ci skip] 2015-04-10 23:23:26 -04:00
Allen Li
bb01e845ea Clarify docstring about mask values [ci skip]
The behavior of paste() with regard to intermediate mask values was
unclear, so this commit clarifies how it works.
2015-04-08 16:03:09 -04:00
hugovk
66e86f325f Catch struct.error on invalid JPEG (#1163) 2015-04-02 08:29:18 +03:00
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
wiredfool
618a79c1c6 Merge from master, pre-unittest conversion 2014-06-03 14:42:22 -07:00
François Boulogne
682ad75759 DOC: fix name in docstring 2014-06-03 16:34:23 -04:00
hugovk
d7ed249b29 Remove redundant commented code [CI skip] 2014-05-27 14:39:33 +03:00
hugovk
fd05e9c756 Test decompression bomb warnings 2014-05-27 12:40:52 +03:00
hugovk
b853696ad5 Remove stray debug print 2014-05-27 12:18:56 +03:00
hugovk
a0d8e5cb33 Set limit to to around a quarter gigabyte for a 24 bit (3 bpp) image 2014-05-27 12:10:10 +03:00
hugovk
29388f8395 Remove redundant comment [CI skip] 2014-05-26 16:26:42 +03:00
hugovk
35f1f4d8fa Change exception into a warning 2014-05-26 16:25:15 +03:00
hugovk
b7e5c27696 Remove temporary print 2014-05-24 17:52:48 +03:00
wiredfool
3b227d1a05 Merge from current master 2014-05-20 11:47:53 -07:00
wiredfool
6ab636fb5a Doc formatting fix 2014-05-20 09:27:56 -07:00
wiredfool
9a6e8f8e9d Noted previous default 2014-05-20 09:21:12 -07:00
wiredfool
8d4a77a939 merge from master 2014-05-20 08:58:09 -07:00
wiredfool
88d74883bb remove redundant transparency check 2014-05-19 14:12:43 -07:00
hugovk
0938145e57 Move to an elif clause of the if in line 778, as it's just another combination of mode,self.mode under the master transparency condition 2014-05-19 10:04:56 +03:00
hugovk
ca7608f1d5 Possible fix for #664 2014-05-17 20:36:17 +03:00
hugovk
ce2955ec71 Throw an exception when an opened image is larger than an arbitrary limit 2014-05-14 18:04:18 +03:00
hugovk
74514fa1f5 Some pep8 and pyflakes cleanup 2014-05-10 12:34:36 +03:00