2

We have added Dianoga to our Sitecore which should convert JPEG, ONG, and SVG to Webp format but can someone explain to me why my SVG files are not getting converted? I have no error in logs, the files are not getting converted in logs as well. Other file types are getting converted. Also, I have the following config in Sitecore:

<mediaLibrary>
  <mediaTypes>
    <mediaType name="SVG image" extensions="svg">
      <mimeType>image/svg+xml</mimeType>
      <forceDownload>false</forceDownload>
      <sharedTemplate>system/media/unversioned/image</sharedTemplate>
      <versionedTemplate>system/media/versioned/image</versionedTemplate>
    </mediaType>
  </mediaTypes>
</mediaLibrary>

Also, I have added Dianoga.svgtools NuGet package to the solution. Can someone suggest to me why it is happening and how can we solve it?

I have enabled the file: https://github.com/kamsar/Dianoga/blob/master/src/Dianoga/Default%20Config%20Files/z.01.Dianoga.NextGenFormats.WebP.config.disabled

Also, the logs are like:

21784 18:07:41 INFO  Dianoga: optimized /abcImages/Casestudy Logo/NGL.png [original size:  8847 bytes] [final size: 5296 bytes] [saved 3551 bytes / 40.14%] [Optimized in 447ms] [Extension webp]
21784 18:07:42 INFO  Dianoga: optimized /abcImages/Casestudy Logo/sunpower-250-90.svg [original size:  15230 bytes] [final size: 11643 bytes] [saved 3587 bytes / 23.55%] [Optimized in 1528ms] [Extension svg]  

If you see png is getting converted but webp is not.

1 Answer 1

2

If you look at the configs, you can see that there's no processor to optimize an SVG to a WebP, and if you look at the webp optimizer, it doesn't accept an SVG. This conversion seems like it would only make sense if you have raster graphics in your SVGs, and the solution there is to get them out and convert.

https://developers.google.com/speed/webp/docs/cwebp
https://github.com/kamsar/Dianoga/blob/master/src/Dianoga/Default%20Config%20Files/z.01.Dianoga.NextGenFormats.WebP.config.disabled

2
  • Thanks for this, but i have enabled this file previously: "github.com/kamsar/Dianoga/blob/master/src/Dianoga/…" and it did not work. Any other thing i would be missing? PS: i have edited and added logs as well in the question.
    – DiveshS
    Oct 4, 2022 at 6:51
  • @DiveshS what didn't work? As I mentioned, neither the config nor the executable will convert a SVG to a WebP. Why are you trying to do this? Do you have a raster graphic embedded in a SVG? If so, I think you need to get those out, save them as the appropriate file, then dianoga will convert them
    – MStodd
    Oct 4, 2022 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.