Junix (JUpyter Notebook Image eXporter)

Finding it troublesome to export images from notebook?
Junix is a simple python package to export plots within Jupyter Notebook.

Output formats include a directory of images or a PDF file (via img2pdf).

Installation

Using pip

pip install junix

Using source code

git clone https://github.com/powerpak/JupyterNotebookImageExporter.git
cd JupyterNotebookImageExporter; python setup.py install

Usage

From command line

junix /path/to/notebook -o path/to/output/directory

filepath: Notebook filepath
-o is an optional argument. If -o is not specified, output directory is current directory (pwd).

From Python

import junix; junix.export_images(filepath, output_dir)

filepath: Notebook filepath
output_dir: Directory where to output notebook images

Exporting PDFs

junix /path/to/notebook -p path/to/output.pdf

or from Python,

import junix; junix.export_pdf(filepath, output_pdf)

Example

Let's consider the following notebook example.ipynb:

Screenshot 2019-09-15 at 2 06 49 PM

By running the following commands:

  • junix example.ipynb (with command line)
  • import junix; junix.export_images(filepath="example.ipynb") (within python terminal)

2 image files will be generated in the same folder as the notebook file (see screenshot below):

Screenshot 2019-09-15 at 1 52 45 PM

License

This project is licensed under the MIT license (see LICENSE.txt). It was forked from damienmarlier51's repo which is also MIT licensed.