#97975image loses transparency when converting svg to webp with image viewhelper
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"/>
</htmlReviews 3
Related issues 1
Files 1
History 1016
-
Georg Ringer commented and changed status
NewNeeds Feedback 06/20/24, 21:15 -
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'] -
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™
-
Garvin Hicking commented 01/28/25, 21:08
Could this be related to: https://forge.typo3.org/issues/106004 ?
-
Sebastian Schmal commented and changed priority
Should haveMust have TYPO3 Version1112 03/26/25, 16:51New 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
-
Garvin Hicking commented and changed priority
Must haveShould 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.
-
Sebastian Schmal commented and changed done
0 %50 % 03/26/25, 19:38Perfect!! I add this code in my Theme Extension ext_localconf.php – works fine! Thanks!
-
Gerrit Code Review pushed patch set 1 for main to change 89032 status
Needs FeedbackUnder Review 04/10/25, 09:08 -
Gerrit Code Review pushed patch set 2 for main to change 89032 04/10/25, 10:24
-
Gerrit Code Review pushed patch set 3 for main to change 89032 04/10/25, 10:33
-
Gerrit Code Review pushed patch set 4 for main to change 89032 04/10/25, 10:38
-
Gerrit Code Review pushed patch set 5 for main to change 89032 04/15/25, 15:33
-
Gerrit Code Review pushed patch set 6 for main to change 89032 04/16/25, 07:29
-
Garvin Hicking commented and changed status
Under ReviewResolved done50 %100 % 04/16/25, 08:45Applied in changeset commit:899c6d9ac84ebce1703569ee55a4060f50ee75ec.
-
Benni Mack changed status
ResolvedClosed 12/02/25, 14:33 -
Garvin Hicking changed Related to #110321 07/29/26, 13:02
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!