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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gl-react-image

v3.2.0

Published

Universal gl-react cropper that implements various resizeMode in OpenGL

Downloads

285

Readme

gl-react-image

Universal gl-react module that implements resizeMode prop in OpenGL.

-> Example App <-

The library is called gl-react-image but barely anything can be the source, it can be a video, a canvas, another stack of effects,... (anything that gl-react support as a texture)

yarn add gl-react-image
import GLImage from "gl-react-image";
import {Surface} from "gl-react-dom";// or "gl-react-native" or "gl-react-expo" or ..

<Surface ...>
  <GLImage
    source="http://i.imgur.com/tCatS2c.jpg"
    resizeMode="stretch"
  />
</Surface>

GLImage Props

  • source (required): the texture input. It can be an image URL or anything gl-react supports for textures.
  • resizeMode: "cover" | "stretch" | "contain" : This implement the exact same React Native Image resizeMode prop in OpenGL.
  • center and zoom props can be used with resizeMode=cover to define the cover crop position:
    • center, an [x,y] array, defines the gravity of the crop (x and y are in [0, 1] bound).
    • zoom should be a value in ] 0 , 1 ] bound. 1 means no zoom, more value is close to 0, more the zoom is important.
  • width and height: only provide if you also want a resize. (this is feeded to the gl-react Node width/height)

Example

-> Example App <-

<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="stretch"
/>

alternative syntax is to use only source via a { uri, width, height } object.

<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="stretch"
/>
<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="contain"
/>
<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="cover"
/>
<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="cover"
  zoom={0.5}
/>
<GLImage
  source="http://i.imgur.com/tCatS2c.jpg"
  resizeMode="cover"
  zoom={0.44}
  center={[ 1, 0.55 ]}
/>

Web usage example

import React from "react";
import {render} from "react-dom";
import {Surface} from "gl-react-dom";
import GLImage from "gl-react-image";

render(
  <Surface width={300} height={300}>
    <GLImage
      source="http://i.imgur.com/tCatS2c.jpg"
    />
  </Surface>
  , document.body
))

React Native usage example

import React from "react";
import {Image, View} from "react-native";
import {Surface} from "gl-react-dom";
import GLImage from "gl-react-image";

export default class Example extends Component {
  static propTypes = {
    src: PropTypes.string.isRequired,
  };
  render () {
    return (
      <Surface style={{ width: 300, height: 300 }}>
        <GLImage
          source={src}
        />
      </Surface>
    );
  }
}