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

lottie-frame

v1.1.0

Published

Convert Lottie animations to PNG frames using Node.js and C++

Readme

Lottie Frame

Description

lottie-frame is a Node.js native addon that allows you to export frames from Lottie animations to PNG images. It leverages the rlottie library for rendering and libpng for PNG encoding, providing a fast and efficient way to extract frames from Lottie animations.

Features

  • Asynchronous and synchronous frame export
  • Configurable frame number, width, height, and quality
  • Native C++ implementation for performance
  • Easy to use Node.js API

Roadmap

  • [x] Initial release with basic frame export functionality
    • [x] Implement native C++ code for performance
    • [x] Implement asynchronous and synchronous frame export
    • [x] Implement configurable options for frame, width, height, and quality
  • [ ] Migrate to a more standard Node.js build system
    • [ ] Investigate and select a suitable build tool
    • [ ] Implement the new build system
    • [ ] Test the build process on different platforms
  • [ ] Add unit tests
  • [ ] Implement CI/CD

Installation

npm install lottie-frame

Requirements

  • Node.js (version 20 or higher)

  • rlottie and libpng must be installed on your system.

    • Ubuntu:

      sudo apt-get update && sudo apt-get install -y libpng-dev librlottie-dev
    • macOS:

      brew install libpng rlottie
    • Windows:

      • Requires python and node-gyp.

Usage

import { exportFrame, exportFrameSync } from 'lottie-frame';
import fs from 'node:fs';

// Load your Lottie animation file
const lottieFile = fs.readFileSync('path/to/your/animation.json');

// Asynchronous example
async function exportLottieFrameAsync() {
  try {
    const pngBuffer = await exportFrame(lottieFile, {
      frame: 30,
      width: 512,
      height: 512,
      quality: 80,
    });

    fs.writeFileSync('frame_async.png', pngBuffer);
    console.log('PNG file saved: frame_async.png');
  } catch (error) {
    console.error('Error exporting frame:', error);
  }
}

exportLottieFrameAsync();

// Synchronous example
try {
  const pngBufferSync = exportFrameSync(lottieFile, {
    frame: 30,
    width: 512,
    height: 512,
    quality: 80,
  });

  fs.writeFileSync('frame_sync.png', pngBufferSync);
  console.log('PNG file saved: frame_sync.png');
} catch (error) {
  console.error('Error exporting frame:', error);
}

API

exportFrame(buffer: Buffer, options?: Options): Promise<Buffer>

Asynchronously exports a frame from a Lottie animation to PNG.

  • buffer: The Lottie JSON animation data as a Buffer.
  • options: (Optional) Configuration options for the export.
    • frame: The frame number to export (non-negative integer, default: 0).
    • width: The width of the exported PNG (integer between 1 and 4096, default: 100).
    • height: The height of the exported PNG (integer between 1 and 4096, default: 100).
    • quality: The PNG compression quality (integer between 1 and 100, default: 100).

Returns: A promise resolving to the PNG data as a Buffer.

Throws:

  • TypeError: If buffer is not a Buffer.
  • RangeError: If any option value is invalid.
  • Error: If the native module fails to process the animation.

exportFrameSync(buffer: Buffer, options?: Options): Buffer

Synchronously exports a frame from a Lottie animation to PNG.

  • buffer: The Lottie JSON animation data.
  • options: (Optional) Configuration options for the export.
    • frame: The frame number to export (non-negative integer, default: 0).
    • width: The width of the exported PNG (integer between 1 and 4096, default: 100).
    • height: The height of the exported PNG (integer between 1 and 4096, default: 100).
    • quality: The PNG compression quality (integer between 1 and 100, default: 100).

Returns: The PNG data as a Buffer.

Throws:

  • TypeError: If buffer is not a Buffer.
  • RangeError: If any option value is invalid.
  • Error: If the native module fails to process the animation.

Building

npm install
npm run build

Prebuilding

npm install
npm run prebuild

License

MIT