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

strapi-v5-image-optimizer

v2.0.5

Published

Convert your images to webp and create a blurhash for them!

Readme


🚀 Installation

Install the plugin using your favorite package manager:

npm install strapi-v5-image-optimizer

or

yarn add strapi-v5-image-optimizer

🚀 Features

📦 WebP conversion

This plugin automatically convert uploaded images to WebP format. To achieve this, it uses the sharp library, which is a powerful image processing tool. The conversion process is optimized to provide a high quality image while maintaining a small file size.

To configure the plugin, you need to add the following configuration to your config/plugins.js file:

export default () => ({
  // ...
  'strapi-v5-image-optimizer': {
    enabled: true,
    config: {
      // Configurate this options(All values here is default)
      webp: {
        enabled: true,
        convertMimeTypes: ['image/jpeg', 'image/png'],
        sharpConfig: {},
        webpConfig: {
          lossless: true,
        },
      },
    },
  },
  // ...
});

If you want conver .gif to .webp you need to turn off Size optimization in Settings => Media Library in your strapi admin panel. After that in config for webp.convertMimeTypes add image/gif to another mime types which you want convert to .webp.

🌟 BlurHash Generation

This plugin automatically generate blurHash for uploaded images. To optimize image loading time, the plugin uses blurhash library. The generation process is optimized to provide a high quality image while maintaining a small file size.

To configure the plugin, you need to add the following configuration to your config/plugins.js file:

export default () => ({
  // ...
  'strapi-v5-image-optimizer': {
    enabled: true,
    config: {
      // Configurate this options(All values here is default)
      blurHash: {
        enabled: true,
      },
    },
  },
  // ...
});

🔄 Updating BlurHash for Existing Photos

To add BlurHash to already uploaded photos, execute the following command in bootstrap your app(src/index.ts) (use it once, then remove it):

export default {
  async bootstrap({ strapi }: { strapi: Core.Strapi }) {
    await strapi.plugin('strapi-v5-image-optimizer').service('blurHashService').updateBlurHash();
  },
};

🆕 Migrate from 'strapi-v5-blurhash-generator' version to 'strapi-v5-image-optimizer'

In strapi-v5-image-optimizer, the plugin generates a 'blurHash' key with a text type, whereas in the strapi-v5-blurhash-generator it generated a JSON object. To migrate from the first version to the second, add this function to your src/index.ts and run it during the bootstrap phase of your application. Once it has been applied, you can remove it.

const migrateFromFirstVersion = async (strapi: Core.Strapi) => {
  const files = await strapi.documents('plugin::upload.file').findMany({
    filters: {
      blurHash: {
        $startsWith: '{',
      },
    },
    limit: 99999,
  });

  const fileUpdates = files.map(async (file) => {
    const documentId = file.documentId;

    if (typeof file.blurHash !== 'string') {
      return;
    }

    const blurHashObject = JSON.parse(file.blurHash);
    const blurHash = blurHashObject['url'];

    await strapi.documents('plugin::upload.file').update({
      documentId,
      data: {
        blurHash,
      },
    });
  });

  await Promise.all(fileUpdates);
};

💖 Acknowledgments

This plugin is inspired by the work of Emil Petraš and his BlurHash generator repository.