@argdown/image-export
TypeScript icon, indicating that this package has built-in type declarations

1.7.5 • Public • Published

@argdown/image-export

Argdown logo

An Argdown parser plugin for exporting svg argument maps to png, jpg or webp files. The plugin uses svg-to-img which in turn uses the headless Chrome/Chromium browser puppeteer. It loads the svg into the browser and makes a snapshot.

Because of puppeteer's large size and Linux installation requirements, this plugin is not part of @argdown/node and has to be installed separately.

Installation and use

Install the package globally:

npm install -g @argdown/image-export

If you are using Linux, you might have to install additional dependencies for Puppeteer. Check the installation notes for svg-to-img and Google's troubleshooting document for further information.

@argdown/cli and @argdown/pandoc-filter will automatically search for the plugin on your computer and use it if needed.

Here is an example of how to use @argdown/cli to export a map to png using @argdown/image-export:

argdown map --format png input.argdown output.png

Configuration

Here is an example of how to specify output folders in an argdown.config.json file:

{
    "png": {
        "outputDir": "./images"
    },
    "jpg": {
        "outputDir": "./images"
    },
    "webp": {
        "outputDir": "./images"
    }
}

You can use the following svg-to-img configuration options in an argdown.config.json file, by using the image config section:

  • type is called format
  • quality
  • width
  • height
  • background
  • encoding

Here is an example:

{
    "image": {
        "format": "jpg",
        "encoding": "base64",
        "background": "#ff0000",
        "quality": 0.5,
    }
}

The clip option is currently not implemented. Say "Hi" on Github, if you need it.

Readme

Keywords

Package Sidebar

Install

npm i @argdown/image-export

Weekly Downloads

4

Version

1.7.5

License

MIT

Unpacked Size

39.9 kB

Total Files

10

Last publish

Collaborators

  • christianvoigt