npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-convert-images

v1.0.3

Published

A Vite plugin to convert images to modern formats and create different conversions

Readme

🖼️ Vite Convert Images

A Vite plugin that automatically converts your raster images into modern formats and responsive variants — with zero hassle.

Demo Added 3 image and 2 more 1 seconds later

✨ Features

🪄 Automatic Downscaling

If you include high-density assets like [email protected] or [email protected], the plugin will:

  • Generate scaled variants (@3x → @2x → @1x, @2x → @1x, depending on max scale).
  • Convert each version to WebP and AVIF formats.

🖼️ LQIP (Low Quality Image Placeholder) Generation

Creates a tiny blurred webp thumbnail perfect for lazy-loading or progressive image effects.

Parallel Image Processing

Handles multiple images in parallel for maximum performance.

🧠 Zero-config & Easy to Use

Install, enable, and enjoy optimized images instantly.

📦 Installation

npm install vite-convert-images --save-dev

Usage

// vite.config.ts
import { defineConfig } from 'vite'
import viteConvertImages from 'vite-convert-images'

export default defineConfig({
  plugins: [
    viteConvertImages()
  ]
})

If you save your image in assets folder it will generate all the conversions

❗️Importnat Note

Images name must be end with @2x, @3x, @4x etc. because the conversions count depends on this number.

For example | Input File | Generated Assets | | ------------------ | -------------------------------------------------------- | | [email protected] | [email protected], [email protected], hero@2x.*, hero@1x.*, [email protected] | | [email protected] | [email protected], [email protected], icon@1x.*, [email protected] |

⚙️ Config options

assetsDir

Assets directory path

  • Type: string
  • Default "/src/assets"

formats

Image formats to convert to

  • Type: ImageFormat[]
  • Default ['avif', 'webp']

formatOptions

Options for each format. This plugin using Sharp behind the scene. Check the documentation for more detail about the different output options.

  • avif
    {
    	quality: 70,
    	effort: 4,
    	chromaSubsampling: '4:2:0'
    }
  • webp
    {
    	quality: 90,
    	effort: 4,
    	smartSubsample: true,
    	nearLossless: false,
    }
  • jpg
  • png

removableExtensions

Remove files with these extensions when the conversion finishes

  • Type: ImageFormat[]
  • Default []

batchSize

Number of concurrent image processing tasks

  • Type number
  • Default 4

enableScaledVariants

Generate scaled variants based on the highest-resolution image

  • Type boolean
  • Default true

enableLogs

Log generated files to the console

  • Type boolean
  • Default false

🕓 Development-Only Behavior

vite-convert-images uses Vite’s watchChange hook to detect when image files are added, modified or removed. This means:

  • 🧩 Image conversion runs only while the Vite dev server is active.

  • ⚡ It processes new or updated images on the fly — no need to restart the server.

This approach ensures that the plugin:

  • Doesn’t slow down your production builds

  • Keeps development feedback loops instant and responsive

  • Provides a live, automatic image pipeline while you work

🚀 Why Use This?

Modern web performance starts with images. vite-convert-images helps you ship smaller, smarter, and future-proof image assets without any manual work.

  • Reduced bundle size — WebP and AVIF can be 50–80% smaller than PNG/JPEG.
  • Responsive ready — Automatically generate variants for different screens.
  • Progressive loading UX — Built-in LQIP means images load gracefully with blur previews.
  • Developer-friendly workflow — Just drop your assets in and the plugin handles the rest.
  • Optimized for modern browsers — Seamlessly deliver next-gen formats with fallback support.

📚 Resources

  • https://web.dev/learn/performance/image-performance
  • https://www.smashingmagazine.com/2021/09/modern-image-formats-avif-webp
  • https://caniuse.com/webp
  • https://caniuse.com/avif

📄 License

MIT License © 2025 feat.