Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numpyimage-1.1.1.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

numpyimage-1.1.1-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file numpyimage-1.1.1.tar.gz.

File metadata

  • Download URL: numpyimage-1.1.1.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for numpyimage-1.1.1.tar.gz
Algorithm Hash digest
SHA256 7667bc8ffc3b4bc878bba54b50de6290a52d9219cf96598f106f49bcacdd24ac
MD5 986d7c14e3b73ebd56c252b8a896005e
BLAKE2b-256 03770e941f3570c34907400d2cebb5a05936a7d1bab31be8eeeb275e684945ff

See more details on using hashes here.

File details

Details for the file numpyimage-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: numpyimage-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for numpyimage-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55d1e1382cfe761cc28d6bef9b5b8216059611b94ddff69d2a34905bacee14ae
MD5 b3b6187beb41766f04ee8e2ac6926637
BLAKE2b-256 7c4a3621af5a56c1a0475e6450c0755958af8b3a2b060ff68278e3b207a383eb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page