Giter VIP home page Giter VIP logo

resvg-cli's Introduction

resvg-cli

version

CLI entry for the @resvg/resvg-js package.
A high-performance SVG renderer CLI, powered by resvg-js.

resvg-js: a high-performance SVG renderer and toolkit, powered by Rust based resvg, with Node.js backend using napi-rs, also a pure WebAssembly backend.

Note

Currently in PR status, awaiting review and merge into the official main branch of @resvg/resvg-js. yisibl/resvg-js#349

Installation

Direct Use

npx resvg-cli --help
# or
bunx resvg-cli --help

Global Install

npm install -g resvg-cli
resvg-js --help

Usage

$ npx resvg-cli --help

NAME:
    resvg-js - A high-performance SVG renderer CLI, powered by resvg-js and Rust based resvg and napi-rs

WEBSITE:
    https://github.com/Zhengqbbb/resvg-cli
    https://github.com/yisibl/resvg-js

VERSION: 2.6.1

SYNOPSIS:
    resvg-js [OPTIONS] <input_svg_path> [output_path]   # If empty output_path. The raw data of image to stdout
    resvg-js [OPTIONS] - [output_path]                  # Receives svg string from stdin

OPTIONS:
  Font:
    --no-system-font                Unuse system font, it will be faster
    --font-file        <file_path>  Local font file path   [Mutilple]
    --font-dir          <dir_path>  Local font directories [Mutilple]
    --font-default-size      <num>  Default font size      [Default: 12]
    --font-default-family    <str>  The default font family
    --font-serif-family      <str>  The serif font family
    --font-sans-serif-family <str>  The sans-serif font family
    --font-cursive-family    <str>  The cursive font family
    --font-fantasy-family    <str>  The fantasy font family
    --font-monospace-family  <str>  The monospace font family

  Rendering Optimize:
    --shape-rendering <0|1|2>       Shape rendering optimize rule
        [0: optimizeSpeed, 1: crispEdges, 2: geometricPrecision]
    --text-rendering  <0|1|2>       Text rendering optimize rule
        [0: optimizeSpeed, 1: optimizeLegibility, 2: geometricPrecision]
    --image-rendering <0|1>         Image rendering optimize rule
        [0: optimizeQuality, 1: optimizeSpeed]

  Fit To (default use original):
    --fit-width   <num>             Use fit to width mode
    --fit-height  <num>             Use fit to height mode
    --fit-zoom    <num>             Use fit to zoom mode

  Crop:
    --crop-top    <num>             Crop image top size
    --crop-left   <num>             Crop image left size
    --crop-right  <num>             Crop image right size
    --crop-bottom <num>             Crop image bottom size

    --dpi        <num>              Dots Per Inch
    --language   <lang>             Language code [Mutilple]
    --background <CSS3_color>       Background color
    --log-level  <level>            Setting log level
        [level: "off" | "error" | "warn" | "info" | "debug" | "trace"]

ARGS:
    <input_file_path>               SVG file path. Use "-" for stdin
    [output_file_path]              Output image file path

EXAMPLES:
  $ resvg-js input.svg output.png
  $ resvg-js --fit-width 1200 input.svg output.png
  $ resvg-js \
        --no-system-font                    \
        --font-file "./Font-Light.ttf"      \
        --font-file "./Font-Bold.ttf"       \
        --font-default-family "Font"        \
        --background "rgba(238,235,230,.9)" \
        ./input.svg ./output.png
  $ cat a.svg | resvg-js --fit-width 1200 --image-rending 0 - output.png

Contributing

pnpm install
pnpm dev        # dev mode
pnpm x --help   # start up the CLI and development

License

Please use all lowercase resvg-js when referencing project names.

MPLv2.0

Copyright (c) 2024, Zhengqbbb
Copyright (c) 2021-present, yisibl(一丝)

resvg-cli's People

Contributors

zhengqbbb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.