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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-emojify-image

v0.0.2

Published

pixelating an image, with emojis

Downloads

5

Readme

react-emojify-image

pixelating an image, with emojis.

shrug

Demo

You can check out the demo here.

Install

npm install --save react-emojify-image

Usage

import EmojifyImage from 'react-emojify-image';

class Emojified extends Component {
  constructor(props) {
    super(props);
    
    this.state = {
      loaded: false
    };
  }
  render({ imgURL, scale }) {
    return (
      <div>
        <img src={imgURL} ref={(_) => (this.img = _)} onLoad={() => this.setState({loaded: true})}/>
        { this.state.loaded && <EmojifyImage scale={10} scale={scale} image={createImageBitmap(this.img)}/> }
      </div>
    );
  }
}

react-emojify-image uses ES2015+ import/export syntax, and other features. Meaning, you have to use a bundler of some sort along with the package, but nowadays who doesn't?

props

name | type | default | required | description ---- | :----: | :-------: | :--------: | ----------- image | ImageBitmap | | yes | An ImageBitmap object of the actual image to use.The easiest way to get this object is to use createImageBitmap().It gets an image source, which can be an , SVG , , OffscreenCanvas, or element, a Blob, ImageData, or another ImageBitmap object. scale | Number | 15 | no | The number of (scale X scale) pixels to replace with one emoji. loader | Function | () => <span>Loading...</span> | no | The loader component to render when either remapping colors to emojis or when emojifying the image.

FAQ

  • How can I load other emojis?

    • Simple! you can use import { EmojifyImageCustom } from 'react-emojify-image'. It's the same thing but it also has an emojis prop which is an array of strings. This serves as the list of emojis to use when reconstructing the image.
  • This package is really big! can you make it smaller?

    • Well, this concerns the last question. You can supply a different set of emojis to use. Also, this was built in a way that tree-shaking can do it's magic. if you'll load EmojifyImageCustom you won't get the entire list of predefined emojis, making this rather small.
  • What are the supported browsers on this thing?

    • Chrome and Firefox. Unfortunately Safari doesn't support ImageBitmap which is used here as a base class to create all image types. Maybe later support for other browsers will be added.
  • Hmmm... but why?

    • Why not?

Contributing

Feel free to open issues and pull requests if you have any other cool ideas for this project :)