SVG Files and auto-format

pludlow Member Posts: 17
edited August 2023 in Developer APIs

I have some SVG files in Cloudinary. On upload I apply an incoming transformation of "fl_sanitize" so that they should be viewable in the browser instead of downloaded.

For the delivery URL I add /q_auto/f_auto, so that if a receiving browser/app doesn't support SVG it will be converted into PNG, WEBP, or whatever. I would like the format to stay SVG when supported, but auto-format seems to always convert to another file format.

I have tested this in Chrome and Safari, and each browser gives me something different than SVG. (Browser support is high for this, Is there a way to accomplish the behavior I would like and passthrough SVG when supported?


Best Answer

  • pludlow
    pludlow Member Posts: 17
    Answer ✓

    There is a solution to this. I worked with support and they enabled "SVG" as an auto-format in my environment. Once that was done, specifying f_auto allowed SVG files to persist as SVG files. Things to note:

    • The fl_sanitize flag should be used on either the incoming transformation for any of your SVG files, or it should be used in the delivery URL (this will be ignored for any image type that isn't SVG)
    • If you access an SVG file directly you'll likely need to use the fl_sanitize flag in the delivery URL as it will include a Content-Disposition header.
    • If you use the SVG as part of an <img> tag you won't need to use fl_sanitize in the delivery URL if the file was sanitized earlier (incoming transformation)
    • This setting is done per environment, so if you have multiple environments it will need to be added to each.


  • Tamara
    Tamara Member, Cloudinary Staff Posts: 110

    Hi there,

    Thanks for reaching out and sorry for the late reply!

    Could you kindly provide your cloud name along with a few examples? If you prefer not to share this information publicly, you can send it in a new private ticket here.

    Looking forward to your response!

    Best regards,


  • pludlow
    pludlow Member Posts: 17

    Tamara, I'll open up a ticket with that information. Thanks.