https://github.com/alberti42/jupyterlab_image_downloader
A Userscript for Downloading images and SVGs rendered in JupyterLab notebooks
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Repository
A Userscript for Downloading images and SVGs rendered in JupyterLab notebooks
Basic Info
- Host: GitHub
- Owner: alberti42
- License: mit
- Language: JavaScript
- Default Branch: main
- Size: 0 Bytes
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
JupyterLab Image Downloader for SVG and Common Image Formats
A userscript to add a download button to images and SVGs rendered in JupyterLab notebooks. This script supports both .svg and common image formats like .png and .jpeg. The download buttons appear in the top-right corner of the rendered output, allowing you to save the plot with a single click.
Features
- Automatically detects and adds a download button to:
- SVG graphics rendered in
.jp-RenderedSVGelements. - Images rendered in
.jp-RenderedImageelements (e.g.,.png,.jpeg).
- SVG graphics rendered in
- Dynamically supports new images added during notebook execution.
- Downloads files in their original format with the correct extension (e.g.,
.svg,.png). - Works with both
httpandhttpsJupyterLab domains.
Example
You can use the code below to test the button.
```python
The line below is a magic command configuring matplotlib to display graphics in SVG format. SVG format is supported natively by JupyterLab and appears embedded as HTML5.
%config InlineBackend.figure_formats = ['svg']
import numpy as np import matplotlib.pyplot as plt
Generate data for the plot
x = np.linspace(0, 2 * np.pi, 100) # 100 points between 0 and 2π y = np.sin(x) # Sine function
Create the plot
plt.figure(figsize=(8, 5)) plt.plot(x*180/np.pi, y, label='sin(x)', color='blue', linewidth=2) plt.title('Plot of sin(x)', fontsize=14) plt.xlabel('x (degrees)', fontsize=12) plt.ylabel('y', fontsize=12) plt.axhline(0, color='gray', linewidth=0.5, linestyle='--') plt.legend(fontsize=12) plt.grid(alpha=0.2)
Show the plot
plt.tight_layout() plt.show() ```
The screenshot below shows how the download button should look if the script is working correctly.

Installation
Install a Userscript Manager:
- For Chrome, Firefox, or Edge, use the recommended Violentmonkey.
- Alternatively, use Tampermonkey or Greasemonkey.
Install the Script:
- Copy the code from JupyterLab Image Downloader and create a new userscript in your script manager.
- Alternatively, click the raw link in the repository to install directly via your userscript manager.
Reload JupyterLab:
- The script will automatically work on both
httpandhttpsJupyterLab domains.
- The script will automatically work on both
Usage
- Open your JupyterLab notebook.
- Execute a cell that generates an image or SVG plot.
- A download button (with a Font Awesome icon) will appear in the top-right corner of the rendered output.
- Click the button to save the plot or image in the appropriate format.
Example Output
The button appears in the top-right corner of any supported element:
html
<div class="jp-RenderedImage" data-mime-type="image/png">
<img src="data:image/png;base64,...">
<button class="download-image-button"><i class="fas fa-download"></i></button>
</div>
Development
To modify or extend the script:
Clone the repository:
bash git clone https://github.com/your-username/jupyterlab-image-downloader.git cd jupyterlab-image-downloaderEdit the userscript (
jupyterlab-image-downloader.js) as needed.Test the changes by pasting the script into your userscript manager.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
- Author: Andrea Alberti
- GitHub Profile: alberti42
- Donations: If you found this script helpful, consider supporting its development via Buy Me a Coffee.
Feel free to contribute to the development of this plugin or report any issues in the GitHub repository.
Owner
- Name: Andrea Alberti
- Login: alberti42
- Kind: user
- Location: Munich
- Website: http://quantum-technologies.iap.uni-bonn.de/alberti
- Repositories: 3
- Profile: https://github.com/alberti42
Quantum physicists
GitHub Events
Total
- Watch event: 2
- Push event: 6
- Create event: 2
Last Year
- Watch event: 2
- Push event: 6
- Create event: 2