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

react-picture-webp

v1.1.9

Published

Picture generator for React-based app. Intelligent work with webP format!

Readme

React-Picture-webP

Tweet

Serve any images' retina set with easy by react-picture-webp (Intelligent webP support included)!

npm Price License: MIT GitHub package version

logo_image

How to use:

  • Prepare: Install react-picture-webp as a regular node_modules package via:
  npm i react-picture-webp

or yarn:

  yarn add react-picture-webp

WebP Important Notice! - to serve webP images via react-picture-webp you need to install webp-checker package via npm i web-checker or yarn add webp-checker. And then run it as soon as possible inside the very first component/module that has an interaction with the whole DOM. (more details here: https://github.com/BiosBoy/webp-checker/readme.md)

Quick Start:

  • You can start using react-picture-webp with just name, path and type fields providing. Only one important notice about folder structure. As this package works with the varios layouts (mobile, tablet, desktop, ect.), you need to put your images consistently by its folders. For example:
 root ---|
         | images ---| // or some particupar image folder
                     | desktop --- |
                                   | [email protected]
                                   | [email protected]
                                   | [email protected] // Tip: you can avoid webp format if needed.
                                   | [email protected]
                     | tablet  --- |
                                   | [email protected]
                                   | [email protected]
                                   | [email protected]
                                   | [email protected]
                     | mobile  --- |
                                   | [email protected]
                                   | [email protected]
                                   | [email protected]
                                   | [email protected]
                     | any etc --- | // some other folder with custom resolutions

This is only one strict requirement while using this package. Probably it would be improved in future, but for not it's the only one way to easily serve various images resolutions inside one <picture />.

So, if your image's folder structure looks like above, you can go ahead and start using this awesome package!

-- Example:

  // ...some logic
  import Picture from 'react-picture-webp'

  class App extends React.Component {
    // ...some logic
  
    render() {
      return (
        <// ..some view start>
          <Picture name='landscape' path='root/images/' pixelDensity={2} type='png' />
        <// ..some view end>
      )
    }
  }

Advanced:

  • In case when you need to set up a better custom config you can throw props as object.

-- Example:

  import Picture from 'react-picture-webp' // import it;

  const config = {
    alt: 'alt_text', // basic alt text for `img` tag describing
    type: 'png', // type of the image provided
    path: 'root/images/', // path to your image (**important:** do not add path here with resolutions' paths including)
    name: 'landscape', // image name
    pixelDensity: 4, // count of the images densinity
    extraResolutions: { // resolutions to layout. By default `react-picture-webp` will serve all these three image resolutions
      desktop: 'min-width: 1001px',
      tablet: 'max-width: 1000px',
      mobile: 'max-width: 600px'
    },
    classes: { // some classes for providing CSS control for your `<picture />`
      picture: 'some_class',
      img: 'some_class'
    }
  }
  
  return (
    <Picture {...config} />
  ); // run picture