Load, save, & manipulate image files as numpy arrays
Project description
npimage
Need to load pixel values from image files as numpy arrays, and hate having to remember whether you should use PIL, tifffile, matplotlib, or something else? Hate having to deal with the fact that those libraries all use different function names and syntaxes? Wish you could just provide a filename and get back a numpy array? This library's imageio.py does that, with array = npimage.load(filename), npimage.save(array, filename), and npimage.show(array) functions that let you easily handle a number of common image file formats without having to remember library-specific syntax. Additionally, vidio.py provides array = npimage.load_video(filename) and npimage.save_video(array, filename) for videos as well. (Another similar library to consider using is imageio.)
Want to draw simple shapes like lines, triangles, and circles into 3D numpy arrays? Frustrated that the python libraries you can find online like opencv and skimage.draw work on 2D arrays but not 3D? I wrote some functions in graphics.py that do the trick in 3D. (If you know of another library that can do this, please let me know!)
Documentation
imageio.py: load, save, or show images.vidio.py: load or save videos.graphics.py: draw points, lines, triangles, circles, or spheres into 2D or 3D numpy arrays representing image volumes.nrrd_utils.py: compress or read metadata from.nrrdfiles.operations.py: perform operations on images.
Check each function's docstring for more details.
Installation
As is always the case in python, consider making a virtual environment (using your preference of conda, virtualenv, or virtualenvwrapper) before installing.
Option 1: pip install from PyPI:
pip install numpyimage
(Unfortunately the name npimage was already taken on PyPI, so pip install npimage will get you a different package.)
Option 2: pip install directly from GitHub:
pip install git+https://github.com/jasper-tms/npimage.git
Option 3: First git clone this repo and then pip install it from your clone:
cd ~/repos # Or wherever on your computer you want to download this code to
git clone https://github.com/jasper-tms/npimage.git
cd npimage
pip install .
After installing, you can import this package in python using import npimage (not import numpyimage!)
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 numpyimage-3.7.0.tar.gz.
File metadata
- Download URL: numpyimage-3.7.0.tar.gz
- Upload date:
- Size: 46.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62e4c6d261b731d51f8e677dabcca0ac93f02f42ce32e10b727f9cf26e8e18ac
|
|
| MD5 |
2768b585cc45872d962fdf06a7e6158b
|
|
| BLAKE2b-256 |
53ac3d9a8809abc6c1018c59face3b80d9498ec2ee3f94d511f5a5e06ec4401b
|
Provenance
The following attestation bundles were made for numpyimage-3.7.0.tar.gz:
Publisher:
publish.yml on jasper-tms/npimage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
numpyimage-3.7.0.tar.gz -
Subject digest:
62e4c6d261b731d51f8e677dabcca0ac93f02f42ce32e10b727f9cf26e8e18ac - Sigstore transparency entry: 1200457983
- Sigstore integration time:
-
Permalink:
jasper-tms/npimage@832f34192f370a8dcd72ff10d5288b27ba390db2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasper-tms
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@832f34192f370a8dcd72ff10d5288b27ba390db2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file numpyimage-3.7.0-py3-none-any.whl.
File metadata
- Download URL: numpyimage-3.7.0-py3-none-any.whl
- Upload date:
- Size: 44.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62f29c575101f208e47233ca828dbfd722ca439dc60f87914aea65aa7109f499
|
|
| MD5 |
d8b55354583a0dfdf40df417dcb1765b
|
|
| BLAKE2b-256 |
6a6c41d433fef0ea68870952fc681a9e827472cf1e8250b4b30bfbecb522d214
|
Provenance
The following attestation bundles were made for numpyimage-3.7.0-py3-none-any.whl:
Publisher:
publish.yml on jasper-tms/npimage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
numpyimage-3.7.0-py3-none-any.whl -
Subject digest:
62f29c575101f208e47233ca828dbfd722ca439dc60f87914aea65aa7109f499 - Sigstore transparency entry: 1200458036
- Sigstore integration time:
-
Permalink:
jasper-tms/npimage@832f34192f370a8dcd72ff10d5288b27ba390db2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasper-tms
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@832f34192f370a8dcd72ff10d5288b27ba390db2 -
Trigger Event:
push
-
Statement type: