Since August 2019, Imgix added support for SVG as input format.
As of today, the Imgix owner account (in our case, DatoCMS), needs to ask Imgix to enable SVG as input format.
I’d like to convert my SVG files uploaded on DatoCMS but this is not working :
$ curl 'https://www.datocms-assets.com/205/1612866826-unified.svg?fm=png' -v > /dev/null 2>&1 | grep -i content-type
< content-type: image/svg+xml
< x-content-type-options: nosniff
The usecase is to be able to send my images in emails where SVG is not well-supported.
May you enable this feature on DatoCMS’s imgix account ?
hey @martin sure, I’ve asked about that, I’ll let you know as soon as possible
hello @martin this should be now enabled. The only thing is that if an asset has already been uploaded you might need to upload it again, OK?
Let me know if you have any issue!
Awesome ! Thanks for the fast answer as always @mat_jack1
I’m glad Imgix now supports SVG and I’ve just uploaded some SVGs again. It’s working if I manually add fm=auto to the url but the graphql responsiveImage type is null.
Will it be possible to use graphql and imgixParams to get the transformed src of SVG images?
Hey, after some considerations we decided to revert the behaviour to the original one, so Imgix transformations are still not supported for SVG files and will be ignored. The reason is that Imgix sometimes fails to interpret SVGs correctly and returns unexpected results, so we prefer to ensure a safe result for everyone in all cases.
Sorry for the change in direction guys!
thank you @s.verna
Just a note:
I used to select the “images” pre-defined extensions option when modelling asset fields, assuming those were the Imgix accepted formats. However, svg is included in this list.
I’m now changing it to custom extensions.
Thanks for the feedback @s.verna. Totally legit to rollback!
I faced some issues with some SVG (black image).
Do you know if Imgix have an ETA of when this will be fixed ?
To be honest, I’m very skeptical that it will ever be implemented 100% correctly. The SVG format is very “dynamic”, for example it allows to include text referencing external fonts… how could Imgix ever render them correctly? The risk of getting something different than expected will always be there unfortunately.
You are right, SVG rendering is quite dynamic and Imgix may not be able to cover all usages.
But for 99% of users, SVG file rendered once is enough.
Users are free to make an API to render dynamic SVG for more advanced usages if needed.