Load, save, and 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 core.py
does that, with array = load(filename)
, save(array, filename)
, and show(array)
functions that let you easily handle a number of common image file formats without having to remember library-specific syntax. (Another choice of library to consider for accomplishing similar goals is imageio, which also supports loading videos through the FFmpeg wrapper library pyav.)
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
core.py
: load, save, or show images.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.nrrd
files.operations.py
: perform operations on images.
For now, check each function's docstring for more. A jupyter notebook demonstrating this package's functions will come later.
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
File details
Details for the file numpyimage-1.2.0.tar.gz
.
File metadata
- Download URL: numpyimage-1.2.0.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed7d1a67848e0f196b13e97433b2391ea5e4e045553cde8a58e79c17f34a122 |
|
MD5 | 4ee1130bae08d9765562d1efe4091b5c |
|
BLAKE2b-256 | a09ec96a1dd1b3dbd89c3bdcdc68c1bbdb6fb27b6d158dc94800ba1f6967e1dc |
File details
Details for the file numpyimage-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: numpyimage-1.2.0-py3-none-any.whl
- Upload date:
- Size: 36.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36cfa71a71bbfc1a232e9864d7a2814d2bd7085d3029a1d1f47d0ca0f1e23c10 |
|
MD5 | 44fdc1e692f8bc39c2ebf36e8f50a5a1 |
|
BLAKE2b-256 | 220cb71303ebdb373fc4f9f3118bc7b23f884a1dffa8ced1ac882578382c068e |