itsmahadi007 / django_advance_thumbnail

Django Advance Thumbnail is a Django app that automates thumbnail creation for image fields. It generates, updates, and deletes thumbnails based on the source image, and allows custom thumbnail sizes.
MIT License
6 stars 1 forks source link

Doesn't support generating thumbnails for .webp with an alpha channel #5

Open andrew-gardener opened 1 month ago

andrew-gardener commented 1 month ago

I get an error when the base image file is a webp with an alpha channel: cannot write mode RGBA as JPEG

I believe all that needs to change is adding webp to the if/else list of formats here https://github.com/itsmahadi007/django_advance_thumbnail/blob/main/django_advance_thumbnail/fields.py#L49 (so it doesn't get changed to jpeg by default)

Alternatively, you can work in a .convert('RGB') to makes sure there is no alpha channel when using the default.

itsmahadi007 commented 1 month ago

You are right, I will soon push a new patch for that.