SVG support in gatsby-plugin-image and gatsby-transformer-sharp #33560
Replies: 2 comments 1 reply
-
You realize SVG is a vector graphic and works COMPLETELY different from bitmap graphics right (JPG, PNG, etc)? Supporting SVG essentially means writing a new module from scratch. Also, what's the point of using SVG with Gatsby Plugin Image? We serve different sizes of bitmap images so that smaller screens don't need to display a 4k image and wasted network bandwidth. But for SVGs, there are no files size differences for different sizes (or resolution for bitmaps, yet vector doesn't have "resolution"). No matter it is |
Beta Was this translation helpful? Give feedback.
-
I am extremely for this request, but would actually be ok if there was no processing done on svgs when used with Gatsby Image. All I want is for content editors to be able to drop in an SVG instead of jpg/png/webp and not cause the developer to do backflips. I am totally ok if the gatsbyImageData that is created just looks like: {
"images": {
"sources":[ ],
"fallback":{ "src":"https://your-image.svg",
"srcSet": "",
"sizes":"(min-width: 800px) 800px, 100vw"
}
},
"layout":"constrained",
"width":800,
"height":418
} Or something like that. I don't need sharp to be able to process svgs. I just need GatsbyImage to not pretend like they don't exist. This would be really useful and make it to where I don't have to wrap a bunch of code around GatsbyImage to make sure SVGs display on the page. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to treat SVG as a "first class citizen" image type? Ie. ability to be queried in GraphQL using
childImageSharp
andgatsbyImageData
and processed byGatsbyImage
orStaticImage
like raster image types (with options to convert to raster image types like PNG, WEBP etc.).Use case: to be able to mix and match SVG with other types of images, for use as featured image in blog posts, etc.
I understand it's possible to display SVGs using
img
or inline them today. I also understand there are some security concerns with SVGs.What I think might be a nice idea is to use SVG as a "source" file, but they are rasterised as part of image optimisation using gatsby-plugin-image, and also be used for social media card images (eg.
og:image
) - I understand Open Graph does not support SVG.Beta Was this translation helpful? Give feedback.
All reactions