
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A CLI for building scientific figure panels from raw files using a JSON definition
figures is a node based command line utility for building up figure panels out of multiple images
that can be used in publications.
It can be installed by:
npm i -g it-figures
A lot of my figures are generated programatically in jupyter notebooks. Building up multi-part
figures is a real pain in Word / LaTeX or in Photoshop. This is an attempt to automate the process
with a simple CLI tool that uses JSON figure definitions.
To start with save a JSON file, e.g. figure-a.json.
{
"data": [
{
"output": "output.png",
"width": "16",
"height": "9",
"sizex": "100",
"sizey": "100",
"images": [
{ "source": "input.svg", "top": "0", "left": "0", "rows": "7", "cols": "9", "caption": "A" },
{ "source": "input.png", "top": "6", "left": "5", "rows": "2", "cols": "3", "offsety": "20" }
]
}
]
}
Then in the same directory run
figures build figure-a.json
Here two images input.svg and input.png will be combined and exported to output.png. See below for more
details about the data format.
NOTE This will build synchronously, which helps reduce some font detection issues in
cairoon the Windows platform. If you are on another platform or don't use captions, theasyncversion of this command may run a little faster.figures async figure-a.json
figure ships as a CLI. Once installed globally, up to date documentation can be viewed by running:
$ figures --help
All of the figure panels defined in the definition file can be built at once by running the build command:
$ figures build my_input_file.json
The basic JSON file is a definition file, which contains information about the figure panels that are
being generated. Multiple figure panels can be generated at once.
The definition file has only one key, data which contains an array of figure panel definitions.
The definition files contain an array of figure panel objects. Figure Builder uses a grid system to position the sub figures. Each panel in the definition file can have separate grid dimensions. Images can then be placed on the grid and are automatically scaled to fit (with aspect ratio preserved).
The figure panel definition object has the following structure:
For example, to create a 1000 x 500 pixel image from a 10 x 10 grid, the following could be provided:
{
// ...
"width": "100",
"sizex": "10",
"height": "50",
"sizey": "10",
// ...
}
Each panel can have an array of included images (which are essentially sub figures of the panel). The image definition object has the following structure:
Note that as aspect ratio is preserved, then the sub figure may not occupy an entire grid square as defined by the top/left and rows/cols
There are currently two supported modes - DEFAULT and SVG.
DEFAULT modeIn this mode, all supported input formats are parsed using sharp. Text captions are added by embedding SVG,
with limited font support.
SVG modeIn SVG mode, all input files must be in SVG format and the output will also be in SVG format
regardless of the supplied file extension. The SVG documents will be positioned, moved and exported
in a new SVG document using svg.js and svgdom. Captions will be added as SVG text elements.
MIT. Contributions welcome.
FAQs
A CLI for building scientific figure panels from raw files using a JSON definition
We found that it-figures demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.