-
I'm developing an application for optimizing comics and knowing the original format is somewhat important, since converting from lossless to lossy formats can often increase file size. Currently I try to convert both and then compare their sizes, but is there a built-in way to check? |
Beta Was this translation helpful? Give feedback.
Answered by
radarhere
Nov 4, 2022
Replies: 1 comment 6 replies
-
A built-in way? No. However, I saw Pillow/src/PIL/WebPImagePlugin.py Lines 17 to 29 in aedbc77 and think that the following should be able to tell you if the WebP file is lossless or not. with open("Tests/images/hopper.webp", "rb") as fp:
lossless = fp.read(15)[-1:] == b"L" |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
avalonv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A built-in way? No.
However, I saw
Pillow/src/PIL/WebPImagePlugin.py
Lines 17 to 29 in aedbc77
and think that the following should be able to tell you if the WebP file is lossless or not.