Skip to content
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/content/docs/en/guides/upgrade-to/v6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1190,14 +1190,38 @@ import myImage from '../assets/photo.jpg';

<SourcePR number="14629" title="feat(assets): Always allow cropping and never upscale" />

In Astro 5.0, the default image service would upscale images when the requested dimensions were larger than the source image.
In Astro 5.x, the default image service would upscale images when the requested dimensions were larger than the source image.
Comment thread
sarah11918 marked this conversation as resolved.

Astro 6.0 removes this behavior: the default image service never upscales images.

#### What should I do?

Review your images and update dimensions as needed. If you do need to upscale images, you may consider upscaling the images manually or using a custom image service that supports upscaling.

### Changed: SVG rasterization

<SourcePR number="15180" title="add support for SVG rasterization" />

In Astro v5.x, Astro's default Sharp image service was unable to convert SVG files to raster files (e.g. PNG, WebP). This meant that the `<Image />` component would ignore any value set for `format` when optimizing and transforming SVG files.

Astro 6.0 now supports SVG rasterization. This is subject to [many limitations](https://github.com/lovell/sharp/issues?q=is%3Aissue%20state%3Aopen%20svg), for instance, SVGs with embedded fonts might not be converted properly. However, when the `format` property is set, the image service will now attempt to convert SVG images.

#### What should I do?

If you were previously relying on the fact that the image service would automatically skip converting SVGs, you must now check the format of your images beforehand to avoid converting SVGs to raster images:

```astro del={1} ins=(3-7}
<Image src={imageThatMightBeAnSvg} format="avif" alt="example" />

<Image
src={imageThatMightBeAnSvg}
format={imageThatMightBeAnSvg.src.format === "svg" ? "svg" : "avif"}
Comment thread
Princesseuh marked this conversation as resolved.
alt="example"
/>
```

<ReadMore>Learn more about [the `format` image property](/en/reference/modules/astro-assets/#format)</ReadMore>

### Changed: Markdown heading ID generation

<SourcePR number="14494" title="feat!: stabilize experimental.headingIdCompat"/>
Expand Down
Loading