From 13cedb92218eb66f966606c66e35aceabaa8aaf6 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 28 Feb 2022 08:36:18 +1100 Subject: [PATCH 1/2] Added release notes for #6069 --- docs/releasenotes/9.1.0.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/releasenotes/9.1.0.rst b/docs/releasenotes/9.1.0.rst index aa4b6af061d..0db1c2600d8 100644 --- a/docs/releasenotes/9.1.0.rst +++ b/docs/releasenotes/9.1.0.rst @@ -153,6 +153,12 @@ By default, :py:meth:`~PIL.Image.Image.getpalette` returns RGB data from the pal A ``rawmode`` argument has been added, to allow the mode to be chosen instead. ``None`` can be used to return data in the current mode of the palette. +Added PyEncoder +^^^^^^^^^^^^^^^ + +:py:class:`~PIL.ImageFile.PyEncoder` has been added, allowing for file encoders to be +written in Python. + Other Changes ============= @@ -169,3 +175,10 @@ Image._repr_pretty_ ``im._repr_pretty_`` has been added to provide a representation of an image without the identity of the object. This allows Jupyter to describe an image and have that description stay the same on subsequent executions of the same code. + +Added BLP saving +^^^^^^^^^^^^^^^^ + +Support has been added for saving BLP images. ``blp_version`` can be used to specify +whether the image should be saved as BLP1 or BLP2, e.g. +``im.save("out.blp", blp_version="BLP1")``. By default, BLP2 will be used. From f2987d65c00ee403120ba63e23a211bcbe17f4c1 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 28 Feb 2022 08:27:39 +1100 Subject: [PATCH 2/2] Linked to file codec documentation --- docs/releasenotes/9.1.0.rst | 3 ++- src/PIL/ImageFile.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/releasenotes/9.1.0.rst b/docs/releasenotes/9.1.0.rst index 0db1c2600d8..22b185e95ac 100644 --- a/docs/releasenotes/9.1.0.rst +++ b/docs/releasenotes/9.1.0.rst @@ -157,7 +157,8 @@ Added PyEncoder ^^^^^^^^^^^^^^^ :py:class:`~PIL.ImageFile.PyEncoder` has been added, allowing for file encoders to be -written in Python. +written in Python. See :ref:`Writing Your Own File Codec in Python` for +more information. Other Changes ============= diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index c63cc61459d..767b38ca41f 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -702,6 +702,8 @@ class PyEncoder(PyCodec): """ Python implementation of a format encoder. Override this class and add the decoding logic in the :meth:`encode` method. + + See :ref:`Writing Your Own File Codec in Python` """ _pushes_fd = False