Native extended Astro components for generating low quality image placeholders (LQIP).
npm install astro-lqip

Native extended Astro components for generating low quality image placeholders (LQIP).
and components.NPM:
``bash`
npm install astro-lqip
PNPM:
`bash`
pnpm add astro-lqip
Yarn:
`bash`
yarn add astro-lqip
In your current Astro project, just replace the import of the native Astro or components with the ones provided by astro-lqip.
`diff`
- import { Image } from 'astro:assets';
+ import { Image } from 'astro-lqip/components';
`diff`
- import { Picture } from 'astro:assets';
+ import { Picture } from 'astro-lqip/components';
Example:
`astro
---
import { Image, Picture } from 'astro-lqip/components';
import image from '/src/assets/images/image.png';
import otherImage from '/src/assets/images/other-image.png';
---
`
> [!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, relative paths and alias.
Example with absolute path:
`astro
---
import { Image, Picture } from 'astro-lqip/components';
---
`
Example with relative path:
`astro
---
import { Image, Picture } from 'astro-lqip/components';
---
`
Example with alias:
`astro
---
import { Image, Picture } from 'astro-lqip/components';
---
`
Learn how to configure path aliasing in the Astro documentation. If you want more examples of uses you can see the Usage Tips page.
Both and components support all the props of the native Astro components, but adds a couple of props for LQIP management:
- lqip: The LQIP type to use. It can be one of the following:base64
- : Generates a Base64-encoded LQIP image. (default option)color
- : Generates a solid color placeholder. Not compatible with lqipSize.css
- : Generates a CSS-based LQIP image.svg
- : Generates an SVG-based LQIP image.lqipSize
- : The size of the LQIP image, which can be any number from 4 to 64. (default is 4)
> [!WARNING]
> A high value for lqipSize can significantly increase the total size of your website.
Example:
`astro
---
import { Image, Picture } from 'astro-lqip/components';
import image from '/src/assets/images/image.png';
import otherImage from '/src/assets/images/other-image.png';
---
`
> [!TIP]
> For the component, a parentAttributes prop similar to pictureAttributes has been added.
Since this integration is built on top of Astro native and
For some simple tips, visit the Usage Tips page.