Review main Abandoned

77923[BUGFIX] Ensure higher image quality in image generation for webp images

TYPO3com CR 0 V 0 Easy +1 −1 updated 10/15/24, 10:09

Commit message

The current image generation implementation uses libwebp provided by
graphicsmagick/imagemagick which defaults to a quality level of 75%
and causes a lot of image artefacts.
This bugfix intends to bind the webp generation to the jpg_quality
setting at least to influence to the final image quality.

Review

  • Code review CR 0
  • Verified V 0

Issues 2

Files 1

Review log 1724

  1. TYPO3com uploaded patch set 1 02/21/23, 23:04

  2. core-ci voted on patch set 1 V +1 02/21/23, 23:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37946

  3. Sybille Peters updated the commit message in patch set 2 V +1 02/22/23, 04:11

  4. core-ci voted on patch set 2 V +1 02/22/23, 04:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37952

  5. Sybille Peters updated the commit message in patch set 3 V +1 02/22/23, 04:37

  6. core-ci voted on patch set 3 V +1 02/22/23, 04:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37953

  7. Reiner Kempkes updated the commit message in patch set 4 V +1 02/22/23, 10:55

  8. core-ci voted on patch set 4 V +1 02/22/23, 11:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37964

  9. Reiner Kempkes updated the commit message in patch set 5 V +1 02/22/23, 11:44

  10. core-ci voted on patch set 5 V +1 02/22/23, 11:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37965

  11. Stefan Bürk commented on patch set 5 CR -1 02/22/23, 12:43

    First, thanks for your patch and welcome on board. Granted, an option for `webp` regarding the quality is missing. But i'm not sure about taking that as "bugfix". Beside this, for me it seems to be really ugly to reuse the `jpg_quality` setting for `webp`. There `should` be a option for that directly - or a more "generic" one, but the `jpg_*` indicates a use for jpg/jpeg ... and not for webp. Therefore, this should be more a feature than a bugfix. Thus v12 only, along with FEATURE rst file and corresponding settings for the configuration setting / install tool with proper description and "default". I would not mix settings for a image format to be used for another. Also, this would be a change for all instances having a quality setting set - resulting in changed instance behaviours. For some good, for some maybe not. Some would not have seen that as an issue at all. If other are convinced that this is a legimit way and a bugfix, I'm still opting to remove at least 10.4 from the list. Thus no -1 for now, giving other space to discuss about this. Would vote for v12 with a dedicated setting and as `FEATURE` only. That would open for eventually more `WebP` related and usefull options to be implemented. As time is running, maybe the image options should be reviewd and a more generic way for options may be usefull a more generic way to do that. An `event` to let extension authors/instances dedice it and hook into the class bootstrap would be another `possible` way eventually - but again a FEATURE and v12 only. Let's here other contributor and merger opinions on that, soft -1 temporarily because of that. Note: Composer-mode instances have the option to composer patch the feature than back if needed.
    Commit message is slighty off. If would suggest, that you may review the core contribution guide about a commit message should be written and which are no goes. Maybe you missed that section. See: https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/Appendix/CommitMessage.html#commitmessage Some short points: * manual wrap lines at max. 72 chars (albit first line may exceed it a little if absolutly needed) * First line starts with an upper case char - and eventually sentence can be shortend to fit the max char limitation ? What would you say for a first line of: ``` [BUGFIX] Ensure higher image quality in image generation for webp images ``` But that more as a general noting/advise/suggestion fur the future. See my main comment, about this change all together. Just wanted to express the things about the commit message generally.
  12. Reiner Kempkes updated the commit message in patch set 6 CR -1 V +1 02/22/23, 14:00

  13. core-ci voted on patch set 6 V +1 02/22/23, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37974

  14. Reiner Kempkes commented on patch set 6 02/22/23, 14:28

    Reply Unresolved

    Thanks for your feedback. In my opinion the webp feature was announced in v10, so it should have worked since then, but it does not. So it is a bug, because the feature cannot be used yet due to too poor image quality (artefacts, text in images is unreadable etc). A typical implementation is, people define their jpg quality to e.g. 90% and use the fluid viewhelper fileExtension attribute to render webp images. When introducing new functionality like new configuration settings, we introduce a new feature, but then it is a completely new topic. The current discussion is about the given image quality is not applied. Technically one will need the same quality setting for different image formats. webp can be used currently only lossy, as the lossless setting is not applied (this would require addional configuration options). Therefore it is a valid approach to apply the setting of jpg_quality also to webp. As the quality one needs is typically higher than the default, it should also be a non-breaking patch. I agree the naming of "jpg_quality" is not good. But the current implementation does not respect anything regarding processor specific settings yet, imagemagick and graphicsmagick both have way more options to improve image quality and these should be configurable as well. PSR Events before image processing would be helpful in future. At the moment i am working in a green coding group and try to push webp to more projects. It would be very helpful to have a working webp implementation for older TYPO3 installations instead of needing another third party extension.

    Reply Unresolved

    Thanks for clarification, typically i only write really short commit messages.
  15. Chris Müller commented on patch set 6 02/22/23, 15:52

    I agree with Stefan, re-using the "jpg_quality" option for webp is confusing and should not the way to go. I also see a feature when introducing a new "webp_quality" option (or a generic "quality" one, although I would like to see them separated).
  16. Josef Glatz commented on patch set 6 02/28/23, 05:58

    Would also see a dedicated option for webp 👍
  17. Benni Mack commented on patch set 6 03/01/23, 08:14

    GraphicalFunctions.php:337 Unresolved

    do we also need this in the few lines below?
  18. Reiner Kempkes commented on patch set 6 03/03/23, 18:16

    Reply Unresolved

    Applying a quality option will render webp images always using lossy encoding. What about encoding png or gif files as webp in lossless quality? When discussing about a new feature, the implementation needs to be more customizable to respect some basic webp configuration options. Also some hooks / events might be helpful. The current implementation is just buggy, do you have any ideas how to influence webp quality otherwise? Following green / sustainable / Web Vitals recommendations is not possible out of the box. A separate configuration option would actually fit better, but i don't see it as a feature here yet. I fixed it temporarily using a XClass on GIFBuilder in my project, but this doesn't fix it in other projects.
  19. Benni Mack updated the commit message in patch set 7 V +1 05/03/23, 09:33

  20. Simon Schaufelberger commented on patch set 7 12/21/23, 13:56

    @benni@typo3.org is this still relevant?
  21. Benni Mack commented on patch set 7 01/09/24, 21:20

    not needed for v13, but might be relevant for v12 and below?
  22. Benni Mack commented on patch set 7 01/09/24, 21:20

    Reply Unresolved

    not needed for v13, but might be relevant for v12 and below?
  23. Benni Mack wrote 01/09/24, 21:20

    Removed cc Benni Mack.
  24. Benni Mack abandoned the change 10/15/24, 10:09

    Hey all, I will abandon this change due to lack of feedback now and because it is solved differently in v13.