Added is_lossless to WebPImageFile#9602
Conversation
|
There's possibly a general case for an "is_lossless" property on many or all Image formats. |
Could you elaborate on this? If we did go with your suggestion, I think it would be better as another key in |
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
My picopt program does lossless optimization. There isn't a way I know of to further compress a lossy WebP image without losing information, so I disqualify images from my program's optimizations by detecting if they were encoded as lossless or not. Your preference for metadata going into the info dict makes sense. If it looks like we should proceed with this, I'll put the bit there. |
I find it useful to know if a WebP Image was encoded with the lossless bit set. While the exact amount of true 'losslessness' in encoded images can be a contentious subject, i find knowing the encoder's intent useful.
This sets the is_lossless property to true if every frame of the WebP was encoded with the lossless bit set. A simple determination for single frame images, but a restrictive judgement call for animated WebP's which main contain a mix of frame types.
Tell me if this looks useful and I can modify this PR to work well as a Pillow contribution.