| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
|
||
| In order to fit the 32 bits of I mode images into PNG, when PNG images can only contain | ||
| at most 16 bits for a channel, Pillow has been clipping the values. Rather than quietly | ||
| changing the data, this is now deprecated. |
There was a problem hiding this comment.
Can we give advice on what people should do instead?
Sorry, something went wrong.
There was a problem hiding this comment.
I've updated the commit to append
Instead, the image can be converted to another mode before saving::
from PIL import Image
im = Image.new("I", (1, 1))
im.convert("I;16").save("out.png")
Sorry, something went wrong.
|
I noticed that the deprecation warning wasn't being emitted for from PIL import Image
im = Image.new("I", (1, 1))
im.save("out.png")This is because the call to deprecate() isn't in the function that the user calls (im.save()), it's one level deeper than that (PngImagePlugin._save). I've added a commit to pass a custom stacklevel to deprecate(). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Resolves #9022
PNG images can only have a maximum of 16 bits per channel - https://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
However, Pillow still allows saving PNG images as I mode, by clipping the data.
The issue has requested that we prevent this automatic transformation, so this PR deprecates it.