-
Couldn't load subscription status.
- Fork 313
Handle alpha for webp if source have alpha #161
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
Conversation
If the source file is a png, then we can keep the alpha for saving in webp format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any sample codes and images to prove this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Sure, here is the code used :
$image = new \Gumlet\ImageResize($base_image);
$image->resizeToWidth(300);
$image->save('2-1f216112gm37-w300.webp', IMAGETYPE_WEBP);
In attachment, 2-1f21g14309151-w300 is the test before the modification, the alpha in the png is not kept.
2-1f216112gm37-w300 is the test after modification.
https://drive.google.com/file/d/1gQIqlC3ZMXtj4JffsRkwyQDrkB99Wa7Y/view?usp=sharing
If the source file is a png, then we can keep the alpha for saving in webp format.