Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

puppeteer-lottie

> 编程语言
Open source

Renders Lottie animations via Puppeteer to image, GIF, or MP4.

383 stars0 likes2 views
WebsiteGitHub

About

Renders Lottie animations via Puppeteer to image, GIF, or MP4.

puppeteer-lottie

Renders Lottie animations via Puppeteer to image, GIF or MP4.

This module is also available as a CLI.

Install

bash
npm install --save puppeteer-lottie

If you want to generate GIFs, you must also install gifski. On macOS, you can run:

bash
brew install gifski

If you want to generate MP4s, you must also install ffmpeg. On macOS, you can run:

bash
brew install ffmpeg

Usage

…

Output Size

If you don't pass width or height, the animation's intrinsic size will be used, and if that doesn't exist it will use 640x480.

If you pass width or height, the other dimension will be inferred by maintaining the original animation's aspect ratio.

If both width and height are passed, the output will have those dimensions, but there will be extra whitespace (or transparency if rendering PNGs) due to lottie-web's default rendererSettings.preserveAspectRatio of xMidyMid meet (docs and demo).

For mp4 outputs, the height may be different by a pixel due to the x264 encoder requiring even heights.

API

renderLottie

Renders the given Lottie animation via Puppeteer.

You must pass either path or animationData to specify the Lottie animation.

output must be one of the following:

  • An image to capture the first frame only (png or jpg)
  • An image pattern (eg. sprintf format 'frame-%d.png' or 'frame-%012d.jpg')
  • An mp4 video file (requires FFmpeg to be installed)
  • A GIF file (requires Gifski to be installed)

Type: function (opts): Promise

  • opts object Configuration options
    • opts.output string Path or pattern to store result
    • opts.animationData object? JSON exported animation data
    • opts.path string? Relative path to the JSON file containing animation data
    • opts.width number? Optional output width
    • opts.height number? Optional output height
    • opts.jpegQuality object JPEG quality for frames (does nothing if using png) (optional, default 90)
    • opts.quiet object Set to true to disable console output (optional, default false)
    • opts.deviceScaleFactor number Window device scale factor (optional, default 1)
    • opts.renderer string Which lottie-web renderer to use (optional, default 'svg')
    • opts.rendererSettings object? Optional lottie renderer settings
    • opts.puppeteerOptions object? Optional puppeteer launch settings
    • opts.ffmpegOptions object? Optional ffmpeg settings for crf, profileVideo and preset values
    • opts.gifskiOptions object? Optional gifski settings (only for GIF outputs)
    • opts.style object Optional JS CSS styles to apply to the animation container (optional, default {})
    • opts.inject object Optionally injects arbitrary string content into the head, style, or body elements. (optional, default {})
      • opts.inject.head string? Optionally injected into the document
      • opts.inject.style string? Optionally injected into a tag within the document
      • opts.inject.body string? Optionally injected into the document
    • opts.browser object? Optional puppeteer instance to reuse

Compatibility

All lottie-web features should be fully supported by the svg, canvas, and html renderers.

This includes all of the animations on lottiefiles.com!

Also see Lottie's full list of supported features.

Related

  • puppeteer-lottie-cli - CLI for this module.
  • puppeteer - Headless Chrome Node API.
  • awesome-puppeteer - Curated list of awesome puppeteer resources.
  • lottie - Render After Effects animations natively on Web, Android and iOS, and React Native.

License

MIT © Travis Fischer

Support my OSS work by following me on twitter

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptffmpeggifskilottielottie-web

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言