Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix conversion issues when converting from formats with alpha channel(png,webp) to jpeg format #59

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

Nitin-Yadav-1
Copy link
Contributor

fixes #32

Converting from png/webp to jpeg creates issues as jpeg doesn't support alpha channel. Simply discarding alpha channel by 'Image.convert()' function of Pillow also creates issues with png/webp images having transparent background.

Added a fix where png/webp images are put on a new blank image of same size. This fills the transparent background and then image can be converted to jpeg.
I set the fill color to be black but perhaps this can be set by user through an argument to 'ResizedImageField'.

@Gagaro
Copy link
Collaborator

Gagaro commented Sep 23, 2024

Thanks for the PR 👍

@Gagaro Gagaro merged commit a09e85d into un1t:master Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with JPEG conversion if there is an alpha channel on the origin image
2 participants