plan2net / webp

Create a WebP copy for images (TYPO3 CMS)
GNU General Public License v3.0
60 stars 33 forks source link

ExternalConverter – Options not working #57

Closed peter-neumann-dev closed 2 years ago

peter-neumann-dev commented 2 years ago

Hello there 👋🏻

If I use other options for JPEG than -jpeg_like processing is not working anymore. There will be no .webp image generated. If I leave it -jpeg_like and use it like in docs, it's working, but image quality is far too bad (size shrinks from 42kb to around 6kb).

✅ Working settings

'convert_all' => '1',
'converter' => 'Plan2net\\Webp\\Converter\\ExternalConverter',
'mime_types' => 'image/jpeg,image/png',
'parameters' => 'image/jpeg::/usr/local/bin/cwebp -jpeg_like %s -o %s|image/png::/usr/local/bin/cwebp -lossless %s -o %s',
'silent' => '0',

🚫 Not working but wanted settings (-lossless or -q 100)

'parameters' => 'image/jpeg::/usr/local/bin/cwebp -lossless %s -o %s|image/png::/usr/local/bin/cwebp -lossless %s -o %s',
'parameters' => 'image/jpeg::/usr/local/bin/cwebp -q 100 %s -o %s|image/png::/usr/local/bin/cwebp -lossless %s -o %s',

Am I doing something wrong? Maybe someone has an idea 🙂 Thanks for any suggestion or help!

wazum commented 2 years ago

@peterneumn take a look at the logs or the database table tx_webp_failed, as the webp is not stored if the image size of the generated file is larger than the original (wouldn't make sense to keep such a file, as the goal of using webp is to serve smaller images to browser that support webp). hth

peter-neumann-dev commented 2 years ago

@wazum Thank you very much for your hint. 😃 I could not find anything in the TYPO3 logs, but the images are listed in the table. I will try again a compression factor that compresses only at a minimum, because actually the images are already compressed by ImageMagick.

peter-neumann-dev commented 2 years ago

Sorry, wrong log file I checked: It says that image is larger than original.

peter-neumann-dev commented 2 years ago

I found a setting with -near_lossless that is working perfect. Thank you! 🙂 Idea: Maybe we should add this hint to the README lossless part, that if the file size is larger than original, it will not be processed?

Otherwise, the issue can be closed 👍🏻

wazum commented 2 years ago

@peterneumn it's already there: https://github.com/plan2net/webp#troubleshooting-and-logging