Vojtěch Struhár

Posted on October 15, 2024 | #astro

Astro: Could not transform image error

Astro’s hint in my case was not helful at all. Neither was their docs for this error.

This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue.

The real cause is Astro uses the sharp npm package for transforming images by default. All I had to do was install it.

npm i -D sharp
Read next: