Skip to content

Commit 61f47e8

Browse files
committed
Images can be converted instead
1 parent d6f2c16 commit 61f47e8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/deprecations.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ Saving I mode images as PNG
200200

201201
In order to fit the 32 bits of I mode images into PNG, when PNG images can only contain
202202
at most 16 bits for a channel, Pillow has been clipping the values. Rather than quietly
203-
changing the data, this is now deprecated.
203+
changing the data, this is now deprecated. Instead, the image can be converted to
204+
another mode before saving::
205+
206+
from PIL import Image
207+
im = Image.new("I", (1, 1))
208+
im.convert("I;16").save("out.png")
204209

205210
Removed features
206211
----------------

docs/releasenotes/11.3.0.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ Saving I mode images as PNG
2828

2929
In order to fit the 32 bits of I mode images into PNG, when PNG images can only contain
3030
at most 16 bits for a channel, Pillow has been clipping the values. Rather than quietly
31-
changing the data, this is now deprecated.
31+
changing the data, this is now deprecated. Instead, the image can be converted to
32+
another mode before saving::
33+
34+
from PIL import Image
35+
im = Image.new("I", (1, 1))
36+
im.convert("I;16").save("out.png")
3237

3338
API changes
3439
===========

0 commit comments

Comments
 (0)