diff options
-rw-r--r-- | .changeset/quiet-games-film.md | 5 | ||||
-rw-r--r-- | packages/astro/components/Picture.astro | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/.changeset/quiet-games-film.md b/.changeset/quiet-games-film.md new file mode 100644 index 000000000..bb9584d36 --- /dev/null +++ b/.changeset/quiet-games-film.md @@ -0,0 +1,5 @@ +--- +"astro": minor +--- + +The `<Picture />` component will now use `jpg` and `jpeg` respectively as fallback formats when the original image is in those formats. diff --git a/packages/astro/components/Picture.astro b/packages/astro/components/Picture.astro index d4327840a..b0791f163 100644 --- a/packages/astro/components/Picture.astro +++ b/packages/astro/components/Picture.astro @@ -17,8 +17,9 @@ const defaultFallbackFormat = 'png' as const; // Certain formats don't want PNG fallbacks: // - GIF will typically want to stay as a gif, either for animation or for the lower amount of colors // - SVGs can't be converted to raster formats in most cases +// - JPEGs compress photographs and high-noise images better than PNG in most cases // For those, we'll use the original format as the fallback instead. -const specialFormatsFallback = ['gif', 'svg'] as const; +const specialFormatsFallback = ['gif', 'svg', 'jpg', 'jpeg'] as const; const { formats = defaultFormats, pictureAttributes = {}, fallbackFormat, ...props } = Astro.props; |