mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
Use jpeg source files as fallback rather than converting to png (#9010)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
This commit is contained in:
parent
653ad939ce
commit
100b61ab5a
2 changed files with 7 additions and 1 deletions
5
.changeset/quiet-games-film.md
Normal file
5
.changeset/quiet-games-film.md
Normal file
|
@ -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.
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue