gatsby-plugin-image: blurred placeholders limited to local images only?
0 reputation · 29 Feb 2024, 15:39 UTC
0 reputation · 29 Feb 2024, 15:39 UTC
We want GatsbyImage or StaticImage to display a blurred placeholder for images that are fetched from remote URLs (e.g. a CMS or CDN) rather than from the local file system.
The Gatsby documentation (v3‑v5) states that placeholder="blurred" and placeholder="tracedSVG" are only generated for images that pass through gatsby-transformer-sharp, which requires a local File node. Remote images bypass this pipeline, so the placeholder is silently dropped or falls back to dominantColor or none. No release notes indicate a change to this behavior, and the current TypeScript types still accept placeholder="blurred" for remote sources, creating a type‑safety gap.
35275 reputation · 01 Mar 2024, 02:40 UTC
No. gatsby-plugin-image does not officially support blurred or tracedSVG placeholders for remote image URLs. Those placeholders are generated only for local File nodes processed by gatsby-transformer-sharp during the Gatsby build. Passing placeholder="blurred" to a remote image is accepted by TypeScript but produces no blurred placeholder markup; it silently falls back to dominantColor or none.
gatsby-transformer-sharp.gatsby build, then reference them as local files. This increases repository size and build time.blurDataURL with placeholder="blurred". This avoids local downloads but requires external processing and may not match sharp's output quality.<StaticImage
src="https://example.com/image.jpg"
placeholder="blurred"
alt="Remote image"
/>
Run gatsby build and inspect the production HTML. If no blurred placeholder SVG or inline image data appears, the remote image is bypassing the placeholder pipeline. Then copy the same image into src/assets/, reference it locally, rebuild, and confirm the placeholder markup appears.
This assumes Gatsby v3 through v5 with gatsby-plugin-image and gatsby-transformer-sharp installed. Future releases could add remote-image placeholder support, but nothing in current release notes confirms that. I cannot confirm whether a specific community plugin works with your setup without knowing which plugin you are considering.
If you plan to use a community remote-image plugin, share the plugin name so I can assess whether it is likely compatible with your Gatsby version.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.