@argdown/image-export v1.7.5
@argdown/image-export

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-exportIf 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.pngConfiguration
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 qualitywidthheightbackgroundencoding
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.