JSPM

aniren

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q56494F
  • License Apache-2.0

A CLI tool to render static or animated HTML/SVG/CSS/JS/SMIL content to static or animated WEBP/GIF/PNG

Package Exports

  • aniren/package

Readme

aniren

A simple command line tool to render/convert HTML/SVG content, optionally animated with CSS/JS/SMIL, to static or animated raster formats, i.e. WEBP/GIF/PNG. Note that rendering and encoding is pretty slow for animated images: it takes the full duration of the animation + encoding/compression (varies by encoder and compression/quality level). Still, there aren't many alternatives out there that support animations, especially free/scriptable/open-source.

Usage

npx aniren -v 192 -q 70 -e 6 input.svg output.webp

This will produce static output.webp at 70% quality and maximum compression (slow).

npx aniren -d 5 -v 256x256 -l input.svg output.png

This will render input.svg for 5 seconds at 256px width and 256px height, capturing frames and producing a lossless (faster) animated (apng) output.png.

Options

aniren [flags] <input> <output>

A CLI tool to render static or animated HTML/SVG/CSS/JS/SMIL content to static or animated WEBP/GIF/PNG

Arguments:
  <input>                               The path to the file to render
  <output>                              Where to write the resulting image

Flags:
  --duration|-d <duration>              The duration in seconds of the input animation.
    If this flag isn't specified or is 0 the output will be static
  --viewport|-v [dimensions]            The viewport dimensions for rendering input.
    This will also be the resolution of the output.
    If a single value is given, it'll be used for both width and height (default: 1280x720)
  --frames-per-second|-f [frame-rate]   The frame rate of the output image in frames per second (default: 30)
  --color-scheme|-c [light|dark]        The color scheme to render the input with.
    If the input does not use media queries, this has no effect (choices: light, dark) (default: light)
  --lossless|-l                         Wether the output should be lossless.
    Setting this speeds things up, but produces significantly larger images.
    Doesn't apply to GIF and static PNG (default: false)
  --quality|-q [quality]                The quality of the output, from 1 to 100.
    Lower values are faster and produce smaller images, but there may be visual artifacts.
    Only applies to WEBP and static PNG (default: 80)
  --palette|-p [number-of-colors]       The number of colors to use for the output, between 2 and 256.
    Lower values are faster and produce smaller images, but visual quality may suffer.
    Ignored if --lossless is specified.
    Doesn't apply to WEBP (default: 256)
  --effort|-e [cpu-effort]              The CPU effort to use for compression, from 1 to 6 for WEBP and 1 to 10 for GIF and static PNG.
    Lower values are faster, but produce larger images.
    Doesn't apply to animated PNG (default: 4)
  --debug                               Print error stack traces (default: false)
  --help|-h                             Show help

License

Apache-2.0