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

image-pixelate

v2.0.0

Published

The **`<image-pixelated>`** web component allows you to pixelate images effortlessly and provides an optional Lego effect for a fun, grid-style overlay. The component is fully responsive and highly customizable with attributes for pixel size, grid size, m

Readme

Image-Pixelated Web Component

The <image-pixelated> web component allows you to pixelate images effortlessly and provides an optional Lego effect for a fun, grid-style overlay. The component is fully responsive and highly customizable with attributes for pixel size, grid size, maximum dimensions, and more.

Mona Lisa Pixelated


Features

  • Pixelation: Pixelates the image using a customizable grid size.
  • Lego Effect: Adds an optional Lego-style grid overlay for visual enhancement.
  • Responsive Design: Automatically scales to fit the specified dimensions while maintaining the aspect ratio.
  • Customizable Attributes: Control pixel size, Lego grid size, maximum dimensions, and enable/disable effects dynamically.
  • Accessible: Includes ARIA attributes for better screen reader support.

Installation

NPM link for Pixelate package

Simply use npm or unpkg to install:

npm install image-pixelate
<script src="https://unpkg.com/[email protected]/js/pixelate.js"></script>

then import using:

import "image-pixelate";

Usage

Simply use as web components:

<image-pixelated
    src="./Mona_Lisa.jpg"
    pixel-size="15"
    lego-size="15"
    max-width="500"
    max-height="600"
    lego-effect
></image-pixelated>

<image-pixelated
    src="./Mona_Lisa.jpg"
    pixel-size="15"
    max-width="500"
    max-height="500"
></image-pixelated>

Attributes

| Attribute | Type | Default Value | Description | |----------------|---------|---------------|-----------------------------------------------------------------------------------------------------| | src | String | null | The URL of the image to pixelate. | | pixel-size | Number | 10 | The size of each pixel in the grid. A higher number results in larger pixels. | | lego-size | Number | 10 | Controls the size of the Lego grid cells. This attribute works only when lego-effect is enabled. | | max-width | Number | 500 | The maximum width (in pixels) for the image. | | max-height | Number | 500 | The maximum height (in pixels) for the image. | | lego-effect | Boolean | false | Enables the Lego grid overlay effect. |


How It Works

  1. Image Loading:

    • The component loads the image from the src URL.
    • If the image exceeds the specified max-width or max-height, it scales down while maintaining the aspect ratio.
  2. Pixelation:

    • The pixel-size attribute determines the size of each pixel block.
    • Pixel data is extracted using the canvas API and redrawn as larger pixel blocks.
  3. Lego Effect:

    • When lego-effect is enabled, a grid-like overlay is added using a background image (circle.png) sized according to the lego-size attribute.

Error Handling

If the src fails to load:

  • A placeholder gray canvas is displayed.
  • An error message ("Image failed to load") is added to the canvas for better user feedback.

Accessibility

  • The canvas includes a role="img" attribute and an ARIA label (aria-label) describing the pixelated image.

Contributing

If you'd like to contribute:

  1. Fork the repository.
  2. Make your changes.
  3. Submit a pull request.

We welcome enhancements and new features!


License

This project is licensed under the MIT License. See the LICENSE file for details.