Issue Bug Closed

#97975image loses transparency when converting svg to webp with image viewhelper

Felix Kleber 07/20/22, 11:42 updated 12/02/25, 14:33

Description

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">

<f:image src="{settings.logoFile}" loading="lazy" fileExtension="webp" width="230"/>

</html

Reviews 3

Files 1

History 1016

  1. Georg Ringer commented and changed status New Needs Feedback 06/20/24, 21:15

    with v13 svgs can now be cropped and it will still be a svg. is it ok to close the issue out of this reason? otherwise please test if still valid in v12, thanks!

  2. Riccardo De Contardi commented and changed attached typo3_bullet_01.svg 01/02/25, 11:07

    I tried the following test with both TYPO3 12 and 13

    1. I uploaded the attached svg file typo3_bullet_01.svg (which has transparency) in /fileadmin/Images
    2. I added to a fluid partial:

    <div style="background:red">
    <f:image src="fileadmin/Images/typo3_bullet_01.svg" loading="lazy" fileExtension="webp" width="50"/>
    </div>

    Result

    On both versions the image is resized, but the conversion to webp removed the transparency and the image has a white background.

    Note: On TYPO3 12 I had to add webp as a valid extension to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']

  3. Garvin Hicking commented 01/02/25, 11:12

    We may need to ensure using “-background none” or ensure lossless conversion for svg input format like
    “convert -background none -define webp:lossless=true input.svg output.webp”

    An not at my computer atm so I’m not sure how to easily pass extra parameters to convert, but I think we have that for color info somehwere™

  4. Garvin Hicking commented 01/28/25, 21:08

    Could this be related to: https://forge.typo3.org/issues/106004 ?

  5. Sebastian Schmal commented and changed priority Should have Must have TYPO3 Version 11 12 03/26/25, 16:51

    New Infos for the T3v12 ?

    File: svg and with fileExtension=“webp”, we have a background-color: white

    Testing with png and fileExtension=“webp”, we have a background-color: transparency/none

  6. Garvin Hicking commented and changed priority Must have Should have 03/26/25, 19:30

    @basti4k Please try to edit your `settings.php` and set this:

        $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileParameters'] = [
            '+profile',
            '*',
            '-background',
            'none'
        ];

    This should add the “-background none” option to the processing call. You may need to upload a “new” image to force creation of the conversion.

    If that works, we’ll need to discuss how to include this as a default. I’m unsure of the drawbacks to other file formats this may have. Your feedback/insight would be much appreciated. Thank you.

  7. Sebastian Schmal commented and changed done 0 % 50 % 03/26/25, 19:38

    Perfect!! I add this code in my Theme Extension ext_localconf.php – works fine! Thanks!

  8. Gerrit Code Review pushed patch set 1 for main to change 89032 status Needs Feedback Under Review 04/10/25, 09:08

  9. Gerrit Code Review pushed patch set 2 for main to change 89032 04/10/25, 10:24

  10. Gerrit Code Review pushed patch set 3 for main to change 89032 04/10/25, 10:33

  11. Gerrit Code Review pushed patch set 4 for main to change 89032 04/10/25, 10:38

  12. Gerrit Code Review pushed patch set 5 for main to change 89032 04/15/25, 15:33

  13. Gerrit Code Review pushed patch set 6 for main to change 89032 04/16/25, 07:29

  14. Garvin Hicking commented and changed status Under Review Resolved done 50 % 100 % 04/16/25, 08:45

    Applied in changeset commit:899c6d9ac84ebce1703569ee55a4060f50ee75ec.

  15. Benni Mack changed status Resolved Closed 12/02/25, 14:33

  16. Garvin Hicking changed Related to #110321 07/29/26, 13:02