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

@tir.jp/glsl2png

v3.0.0

Published

Render GLSL fragment shaders to PNG images or standalone HTML using Puppeteer and WebGL2.

Readme

@tir.jp/glsl2png

npm version License

Render GLSL fragments to PNG or standalone HTML using Puppeteer and WebGL2.

This tool is designed to facilitate an incremental development cycle for fragment shaders, allowing you to quickly iterate on your GLSL code and verify the results.

Features

  • glsl2png: Render a GLSL fragment shader to a PNG image.
  • glsl2html: Generate a standalone, responsive HTML file that runs the shader in a browser.
  • Headless & Visible: Supports headless rendering for CI/CD or visible mode for live preview.
  • Multi-frame Support: Specify multiple time points to generate a sequence of images.
  • WebGL2 Support: Built for modern GLSL (ES 300).

Installation

npm install -g @tir.jp/glsl2png

Or use it directly via npx:

npx @tir.jp/glsl2png --help

Usage

glsl2png

Render a shader to a PNG file.

glsl2png <fragment_shader_path> [options]

Options:

  • --width <number>: Canvas width (default: 512).
  • --height <number>: Canvas height (default: 512).
  • --time <number>: Time value to pass as u_time. Can be specified multiple times for multiple outputs.
  • --out <path>: Output PNG path (default: output.png).
  • --no-headless: Launch browser in non-headless mode for live preview.

Example:

# Single image at time 1.0
glsl2png samples/basic.frag --time 1.0 --out result.png

# Multiple images (generates animation_0.png, animation_1.png, ...)
glsl2png samples/basic.frag --time 0.0 --time 0.5 --time 1.0 --out animation.png

glsl2html

Generate a standalone HTML file. It is auxiliary tool for share glsl animation easily.

glsl2html <fragment_shader_path> [options]

Options:

  • --width <number>: Canvas width (default: 512).
  • --height <number>: Canvas height (default: 512).
  • --out <path>: Output HTML path (default: output.html).

Example:

glsl2html samples/basic.frag --out preview.html

GLSL Requirements (WebGL2)

Your fragment shaders should follow the WebGL2 (ES 300) specification:

  • Header: Must include #version 300 es.
  • Precision: Must define precision, e.g., precision highp float;.
  • Input: Use in vec2 v_uv; to get the aspect-corrected vertex position (the shorter axis is in the range -1.0 to 1.0).
  • Output: Use out vec4 fragColor; instead of gl_FragColor.
  • Built-in Uniforms:
    • uniform vec2 u_resolution;: Viewport resolution (width, height) in pixels.
    • uniform float u_time;: Current time in seconds.

Example Shader (basic.frag)

#version 300 es
precision highp float;

in vec2 v_uv;
uniform vec2 u_resolution;
uniform float u_time;

out vec4 fragColor;

void main() {
    // v_uv is already aspect-corrected.
    // Map to 0.0-1.0 range (caution: range varies by aspect ratio)
    vec2 uv = (v_uv + 1.0) * 0.5;
    vec3 col = 0.5 + 0.5 * cos(u_time + uv.xyx + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}

And see samples/ directory.

Gallery

Fractal KIFS

glsl2png samples/fractal_kifs.frag --out img/fractal_kifs.png --time 1.0

Fractal KIFS

Fractal Raymarching

glsl2png samples/fractal_raymarching.frag --out img/fractal_raymarching.png --time 1.0

Fractal Raymarching

Nature

glsl2png samples/nature.frag --out img/nature.png --time 1.0

Nature

Voronoi

glsl2png samples/voronoi.frag --out img/voronoi.png --time 1.0

Voronoi

ChangeLog

  • 3.0.0: 20260506

    • Adjust aspect-ratio in vertexShader, not fragmentShader
  • 2.0.0: 20260427

    • Support v_uv

License

Zlib License.