In your current Astro project, just replace the import of the native Astro
<Image>
or
<Picture>
component with the ones provided by
astro-lqip
Image
- import { Image } from 'astro:components';+ import { Image } from 'astro-lqip/components';
Picture
- import { Picture } from 'astro:components';+ import { Picture } from 'astro-lqip/components';
Example:
---import { Image, Picture } from 'astro-lqip/components';import image from './path/to/image.png';import otherImage from './path/to/other-image.png';---<Image src={image} alt="Cover Image" width={220} height={220} /><Picture src={otherImage} alt="Other cover Image" width={220} height={220} />
Tip
Since version
1.6.0
, you can also put the image path as string directly in the
src
prop. Support absolute paths in
src
folder, relative paths and alias.