A lightweight NumPy array image viewer for Spyder
Project description
Spyder Image Viewer Plugin
A lightweight image viewer plugin for Spyder focused on fast NumPy array inspection.
Notice
This plugin was generated almost entirely (nearly 100%) with GitHub Copilot.
Highlights
- Fast rendering at high zoom levels using viewport-only drawing.
- Docked viewer integrated with Spyder Variable Explorer.
- Optional popup viewers from Variable Explorer context menu.
- Nearest-neighbor scaling (no blur) for pixel-accurate inspection.
- Zoom range from 10% to 3000%.
- Pixel grid and value overlay at 3000% (
Show Pixels). - Hover tooltip with coordinate and value/intensity.
- Channel selector for 3D images (
full, or per-channel grayscale view).
Supported Input
The plugin accepts NumPy arrays with:
H x W(2D)H x W x C(3D,C >= 1)
There is no fixed channel-count restriction in 3D mode. For example, H x W x 10 is supported.
Accepted dtypes include integer and floating-point arrays. Arrays are normalized to uint8 for display.
Float normalization behavior:
[0, 1]-> scaled to[0, 255][0, 255]-> used as-is- other ranges -> min-max normalized to
[0, 255]
Requirements
- Python >= 3.7
- Spyder >= 5.0
- NumPy >= 1.19
- QtPy >= 2.0
Installation
Option 1: Install from PyPI (recommended)
pip install spyder-image-viewer
After installation, restart Spyder to load the plugin.
Option 2: Editable install (for local development)
cd spyder_image_viewer
pip install -e .
This allows you to edit the source code and see changes reflected immediately.
Option 3: Standard install from source
cd spyder_image_viewer
pip install .
Verify installation
After installation, restart Spyder and check:
Tools → Preferences → Plugins
Confirm Image Viewer is listed and enabled.
Usage
- Start Spyder.
- Create an image-like NumPy array:
import numpy as np
img = np.random.randint(0, 256, (1080, 1920, 3), dtype=np.uint8)
- In Variable Explorer, select
img. - The image appears in the
Image Viewerdock.
You can also right-click a variable and choose Open in Image Viewer to open an independent popup window.
Controls
- Zoom slider:
10%to3000% - Mouse wheel: normal scrolling
Ctrl + wheel: nonlinear zoom- Zoom anchor: cursor-centered when over image, otherwise viewport-centered
Show Pixels: jump to3000%temporarily and restore previous zoom when toggled offChannelcombo (3D images):fullshows color image- numeric channels show single-channel grayscale
Pixel Overlay and Tooltip
At 3000%, the viewer can render:
- pixel grid
- per-pixel values (in single-channel mode)
Hover tooltip:
Coord: (x, y)Intensity: ...for scalar viewsValue: (...)for multi-channel views
Project Structure
spyder_image_viewer/
├── setup.py
├── setup.cfg
├── README.md
├── README.ja.md
├── docs/
│ ├── quickstart.md
│ ├── development_guide.md
│ └── ja/
│ ├── quickstart.ja.md
│ └── development_guide.ja.md
├── spyder_image_viewer/
│ ├── plugin.py
│ ├── widgets/
│ │ └── image_viewer.py
│ └── utils/
│ └── array_validator.py
└── tests/
└── manual_test_image_viewer.py
Development
Run the test script:
python tests/manual_test_image_viewer.py
Or in a Spyder console:
exec(open('tests/manual_test_image_viewer.py').read())
Troubleshooting
Plugin not found
- Reinstall in editable mode:
pip uninstall spyder-image-viewer
pip install -e .
-
Restart Spyder completely.
-
If needed, clear Spyder cache:
rm -rf ~/.spyder-py3/
Dock is hidden
Open in Spyder:
View → Docks → Image Viewer
"Not a valid image array"
Verify array shape:
from spyder_image_viewer.utils import is_image_array
print(is_image_array(your_array))
Supported shapes:
- 2D:
(H, W) - 3D:
(H, W, C)whereC >= 1
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spyder_image_viewer-0.1.3.tar.gz.
File metadata
- Download URL: spyder_image_viewer-0.1.3.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f05842850f93784e1a79bd7fba5af21ada18826da897a6d81a293a870d04949
|
|
| MD5 |
1df4a05bd93464b07c849f43dcc051b6
|
|
| BLAKE2b-256 |
9dffec9eb44c4fd237495287ba4af6eee67a949550e351994b1c1850432f54b9
|
File details
Details for the file spyder_image_viewer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: spyder_image_viewer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b6f78c9a21c0f845f1c94ed6f14ceec2b6455fdde5fb5b97007a3774980c10
|
|
| MD5 |
ec24284b8a3a0d749c5b1ad8ecda60d9
|
|
| BLAKE2b-256 |
e7329e3a2a391c61d215afe3c38e3272f9fd130fe79f43998eaaa9e737d64a3f
|