Commit Graph

15211 Commits

Author SHA1 Message Date
Matthew Treinish
9517feccd9
Update src/PIL/Image.py
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2023-07-06 09:00:00 -04:00
Matthew Treinish
6d440ac995
Handle exceptions in _repr_jpeg_ and _repr_png_
In 10.0.0 a _repr_jpeg_ implementation was added to the Image object to
enable the use of display_jpeg() in IPython environments. However, in
some cases the implementation of this method could result in an
exception being raised while trying to generate the jpeg data. The best
example is if the image data is in an RGBA format as a result of the
object being created by opening a PNG file. In this case trying to save
the Image object as a jpeg will error because the jpeg format can't
represent the transparency in the alpha channel. This results in an
exception being raised in the IPython/Jupyter context when outputing the
image object. However, in cases like this IPython allows the repr
methods to return None to indicate there is no representation in that
format available. [1] This commit updates the _repr_png_ and _repr_jpeg_
methods to catch any exception that might be raised while trying to
generate the image data. If an exception is raised we treat that as not
being able to generate image data in that format and return None
instead.

Related to #7259

[1] https://ipython.readthedocs.io/en/stable/config/integrating.html#custom-methods
2023-07-06 08:42:37 -04:00
Hugo van Kemenade
f089c2db8c
Merge pull request #7264 from radarhere/macos 2023-07-06 09:25:29 +03:00
Andrew Murray
e6beb81523 Updated macOS tested Pillow versions 2023-07-06 13:22:50 +10:00
Hugo van Kemenade
3ffa8dca44
Merge pull request #7262 from daimrod/doc-wal-add-link-to-putpalette 2023-07-05 14:43:51 +03:00
Grégoire Jadi
9a32c0f821
doc WAL: Add link to PIL.Image.Image.putpalette
[ci skip]
2023-07-05 11:26:46 +02:00
mergify[bot]
3ee9259150
Merge pull request #7258 from radarhere/libjpeg
Updated libjpeg shared library name
2023-07-04 14:17:51 +00:00
Andrew Murray
5a9c2321b4 Updated libjpeg shared library name 2023-07-04 22:39:41 +10:00
Hugo van Kemenade
be828f4d62
Merge pull request #7254 from radarhere/libjpeg_turbo
Updated libjpeg-turbo to 3.0.0
2023-07-04 07:44:58 +03:00
mergify[bot]
84af332bf1
Merge pull request #7253 from python-pillow/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-07-03 22:37:52 +00:00
Andrew Murray
082c43656d Updated libjpeg-turbo to 3.0.0 2023-07-04 08:29:17 +10:00
pre-commit-ci[bot]
9e31a677b9
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/yesqa: v1.4.0 → v1.5.0](https://github.com/asottile/yesqa/compare/v1.4.0...v1.5.0)
- [github.com/tox-dev/tox-ini-fmt: 1.3.0 → 1.3.1](https://github.com/tox-dev/tox-ini-fmt/compare/1.3.0...1.3.1)
2023-07-03 19:29:28 +00:00
Andrew Murray
a97422d2fe
Merge pull request #7249 from Yay295/update_c_type_obj
Update PyTypeObject slot names
2023-07-03 19:43:50 +10:00
Hugo van Kemenade
6b0b905a88
Merge pull request #7248 from mgorny/wheel 2023-07-02 19:27:23 +03:00
Yay295
e7398c7888 update PyTypeObject slot names
tp_print was renamed to tp_vectorcall_offset with Python 3.8, and tp_compare was renamed to tp_as_async with Python 3.5.
tp_size has always been tp_basicsize; I don't know why that one was wrong.
2023-07-02 00:52:08 -05:00
Michał Górny
d56fb2435d Remove redundant wheel dep from pyproject.toml
Remove the redundant `wheel` dependency, as it is added by the backend
automatically.  Listing it explicitly in the documentation was
a historical mistake and has been fixed since, see:
f7d30a9529

While Pillow uses a custom backend that modifies the `bdist_wheel`
method, it does not import `wheel` or use it in a way that would rely
on setuptools implementation details.
2023-07-02 04:13:02 +02:00
Andrew Murray
1ffe3354d7 10.1.0.dev0 version bump 2023-07-02 00:59:40 +10:00
Andrew Murray
6e28ed1f36 10.0.0 version bump 2023-07-01 22:08:11 +10:00
Andrew Murray
c827f3b30f
Merge pull request #7246 from radarhere/deallocate
Fixed deallocating mask images
2023-07-01 20:35:41 +10:00
Andrew Murray
39a3b1d83e Fixed deallocating mask images 2023-07-01 18:09:27 +10:00
Andrew Murray
8c1dc819fd
Update CHANGES.rst [ci skip] 2023-07-01 10:31:34 +10:00
Andrew Murray
e37b25087d
Merge pull request #7244 from radarhere/imagefont_max_string_length
Added ImageFont.MAX_STRING_LENGTH
2023-07-01 09:41:01 +10:00
Andrew Murray
d398fedb9d
Added underscores for readability
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-07-01 07:25:18 +10:00
Andrew Murray
1fe1bb49c4 Added ImageFont.MAX_STRING_LENGTH 2023-06-30 23:32:26 +10:00
Hugo van Kemenade
7c945f5131
Merge pull request #7243 from radarhere/releasenotes 2023-06-30 10:59:47 +03:00
Andrew Murray
0fb69fa821 Added release notes for #7123 2023-06-30 16:59:36 +10:00
Hugo van Kemenade
b7f1af77fd
Merge pull request #7230 from nulano/add-pyproject.toml 2023-06-30 09:31:41 +03:00
Hugo van Kemenade
0ac3677b56
Merge pull request #7199 from radarhere/tiff_close 2023-06-30 09:27:26 +03:00
Hugo van Kemenade
9abef1ad0b
Merge pull request #7226 from radarhere/getcolor 2023-06-30 09:26:51 +03:00
Hugo van Kemenade
be4bfaac9e
Merge pull request #7123 from radarhere/apng 2023-06-30 09:24:20 +03:00
Hugo van Kemenade
bd795d7c02
Merge pull request #7242 from radarhere/repr_png
Prioritise speed in _repr_png_
2023-06-30 08:29:47 +03:00
Andrew Murray
0740499151 Prioritise speed in _repr_png_ 2023-06-30 09:05:59 +10:00
Hugo van Kemenade
1174a9e7f4
Merge pull request #7097 from radarhere/seek
`Image.open()` seeks to the start of file objects
2023-06-30 01:05:47 +03:00
Hugo van Kemenade
a662fb6793
Merge pull request #7239 from radarhere/releasenotes
Added release notes for #7235
2023-06-29 15:24:38 +03:00
Andrew Murray
49cde0ad3d Update CHANGES.rst [ci skip] 2023-06-29 21:03:42 +10:00
Andrew Murray
ae43cda4c5 Added release notes for #7235 2023-06-29 20:59:24 +10:00
Hugo van Kemenade
2de1bf221a
Merge pull request #7236 from radarhere/pyaccess 2023-06-29 13:58:50 +03:00
Hugo van Kemenade
b2387f9565
Merge pull request #7233 from radarhere/libtiff 2023-06-29 13:56:12 +03:00
Hugo van Kemenade
0aaa5e0d7c
Merge pull request #7238 from radarhere/libwebp 2023-06-29 13:54:46 +03:00
Andrew Murray
444b8118bd Updated libwebp to 1.3.1 2023-06-29 15:11:16 +10:00
Andrew Murray
456ef61cb5 Update CHANGES.rst [ci skip] 2023-06-29 09:43:06 +10:00
Andrew Murray
b5ce3193b6 Deprecate Image.USE_CFFI_ACCESS 2023-06-29 08:30:10 +10:00
Andrew Murray
1a185973dd Mention default behaviour change 2023-06-28 22:00:32 +10:00
Andrew Murray
8a36b0fc2d Deprecate PyAccess 2023-06-28 20:10:10 +10:00
Andrew Murray
811bfe3658 Do not use CFFI access by default on PyPy 2023-06-28 17:57:02 +10:00
Andrew Murray
b2d7f1e899
Merge branch 'main' into add-pyproject.toml 2023-06-28 17:44:08 +10:00
Andrew Murray
e5188f6815
Merge pull request #7235 from radarhere/decompression_bomb_check
Limit size even if one dimension is zero in decompression bomb check
2023-06-28 13:37:29 +10:00
Andrew Murray
8437d98f7f Limit size even if one dimension is zero 2023-06-28 11:43:05 +10:00
Hugo van Kemenade
4834f80c08
Merge pull request #7234 from radarhere/32bit 2023-06-27 18:34:28 +03:00
Andrew Murray
1756f04acd
Updated patch path
Co-authored-by: Ondrej Baranovič <nulano@nulano.eu>
2023-06-27 21:19:32 +10:00