You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempt to get mapping from MIME type to PIL format via PIL.Image.MIME
What did you expect to happen?
A filled dictionary mapping from MIME type to PIL format.
What actually happened?
Empty dict. It looks like PIL.Image.init() populates this registry.
It's understandable if this method needs to be called before the MIME registry is populated. But some documentation surrounding this and the MIME variable would be useful. I was especially surprised when PIL.features.pilinfo() populated this variable as a side effect.
What are your OS, Python and Pillow versions?
OS: macOS Monterey 12.6.8
Python: 3.8.15
Pillow: 10.0.0
if__name__=="__main__":
print(f"PIL.Image.MIME before pilinfo(): {Image.MIME}")
features.pilinfo()
print(f"PIL.Image.MIME after pilinfo(): {Image.MIME}")
The text was updated successfully, but these errors were encountered:
What do you think of #7399? With it, you should be able to go to the documentation for the Image module, search for "MIME" and find this screen telling you everything you need to know -
register_mime() tells you that it populates Image.MIME
The 'Note' tells you that register_mime() is called by preinit() or init()
init() tells you that it is called when opening, saving or by features.pilinfo()
What did you do?
Attempt to get mapping from MIME type to PIL format via
PIL.Image.MIME
What did you expect to happen?
A filled dictionary mapping from MIME type to PIL format.
What actually happened?
Empty dict. It looks like
PIL.Image.init()
populates this registry.It's understandable if this method needs to be called before the MIME registry is populated. But some documentation surrounding this and the MIME variable would be useful. I was especially surprised when
PIL.features.pilinfo()
populated this variable as a side effect.What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: