Closed stevy80 closed 1 year ago
虚幻之物对应着冥冥之路!:《羽》
Cannot reproduce. The following test passes without errors. Does it depend on the source PNG file?
--- a/tests/system/Images/GDHandlerTest.php
+++ b/tests/system/Images/GDHandlerTest.php
@@ -412,6 +412,14 @@ final class GDHandlerTest extends CIUnitTestCase
$this->assertSame(exif_imagetype($this->start . 'work/ci-logo.png'), IMAGETYPE_PNG);
}
+ public function testImageConvertPngToWebp(): void
+ {
+ $this->handler->withFile($this->origin . 'ci-logo.png');
+ $this->handler->convert(IMAGETYPE_WEBP);
+ $this->handler->save($this->start . 'work/ci-logo.webp');
+ $this->assertSame(exif_imagetype($this->start . 'work/ci-logo.webp'), IMAGETYPE_WEBP);
+ }
+
public function testImageReorientLandscape(): void
{
for ($i = 0; $i <= 8; $i++) {
Yes, it depends from the png. Some works (like ci-good.png), some not (ci-bad.png).
@stevy80 Thank you! I sent a PR #8210
PHP Version
8.2
CodeIgniter4 Version
4.4.2
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
MySQL 8
What happened?
When converting some .png images to .webp with the using of the image library (gd), the following error occurs: imagewebp(): Palette image not supported by webp
Steps to Reproduce
Expected Output
valid webp file
Anything else?
currently the code in the GDHandler.php (save function):
if I use imagepalettetotruecolor there, the problem solved for me, like: