Back to Withastro

Expected image options.

src/content/docs/en/reference/errors/expected-image-options.mdx

latest638 B
Original Source

import DontEditWarning from '~/components/DontEditWarning.astro'

<DontEditWarning />

ExpectedImageOptions: Expected getImage() parameter to be an object. Received OPTIONS.

What went wrong?

getImage()'s first parameter should be an object with the different properties to apply to your image.

ts
import { getImage } from "astro:assets";
import myImage from "../assets/my_image.png";

const optimizedImage = await getImage({src: myImage, width: 300, height: 300});

In most cases, this error happens because parameters were passed directly instead of inside an object.

See Also: