wagtail / Willow

A wrapper that combines the functionality of multiple Python image libraries into one API
https://willow.wagtail.org/
BSD 3-Clause "New" or "Revised" License
273 stars 53 forks source link

feat: add mime type to ImageFile #102

Closed dopry closed 1 year ago

dopry commented 1 year ago

Add mime_type to ImageFile to facilitate generating Content-Type headers for images

While working on https://github.com/wagtail/wagtail/pull/8974 @jams2 noted that Pillow provided a content_type that was lost in the switch to Willow. I implemented a mapping of format_name to mime_type to resolve the issues, but it would be better if we could get the mime_type from the ImageFile instance returned by willow.open

dopry commented 1 year ago

@kaedroho @jams2 @zerolab I'd love a review on this. It's pretty small, but it is an interface addition.