ezimage
What is ezimage?
Load and display images and access its content data with one-liners. A wrapper for PIL and IPython.display, ideal for machine learning and image processing. Easily load a PNG/JPEG image (or a list of them) from a local machine or the web and use its data in any desired format (e.g. NumPy/PyTorch/TensorFlow/etc). Display or save data arrays from any format or ordering (CHW/WCH). All with one-liners.
Installation
pip install ezimage
Example Usage
from ezimage import ezimage
img = ezimage(url='https://tinyurl.com/yyxvexs6')
img.CHW
Watch this tutorial on YouTube for a walk through.
Description
Enables the user to easily load an image from a path, a url, or by directly providing a data array. If a list is provided, a list of ezimage instances will be retunred.
The properties enable the user to access the image data in R, G, B, A, GS (grayscale), HWC, and CHW formats.
In IPython environments such as in Jupyter, the display method allows the user to view images. Unlike PIL, this method allows for iterative image display.
Regardless of the ordering, format, or type of data, if directly feeding data arrays, all values must be in a valid PNG range (between 0 and 255).
Versatile Data Type and Data Format
User is free to choose the format of the data arrays specified with format_func.
format_func is a function that converts a PIL image to user's desired format.
The output must cast to a NumPy array (i.e. no error when running np.array(format_func(PIL_img))). See examples below.
Note that the internal computations are done using PIL functions or NumPy arrays and format_func is only designated for the user interface.
NumPy uint8 Example:
format_func=lambda PIL_Image: np.array(PIL_Image, dtype=np.uint8)
NumPy float16 Example:
format_func=lambda PIL_Image: np.array(PIL_Image, dtype=np.float16)
PyTorch float32 Example:
import torch
format_func=lambda PIL_Image: torch.tensor(np.array(PIL_Image), dtype=torch.float32)
Example usage for a single image from the web:
img = ezimage(url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Omar_Khayyam2.JPG/220px-Omar_Khayyam2.JPG")
img.display()
Example usage for reading all PNG files in a directory:
from ezimage import ezimage
from pathlib import Path
path_parent = Path("path/to/image/folder/")
pathList = list(path_parent.glob("*.png"))
imgList = [ezimage(p) for p in pathList]
for img in imgList:
img.display(print_name=True)
Metadata
Release files for ezimage 0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ezimage-0.8-py3-none-any.whl | Python 3 | none | any | Details for ezimage-0.8-py3-none-any.whl |
Release files / ezimage-0.8-py3-none-any.whl
| Download URL | ezimage-0.8-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6b7edfe23a9cf0441aae5991cdc12f7fe4f0b5f8396ba111231ec8c58aa7b42
|
|
BLAKE2b-256 checksum How to use checksums |
d2fb247e2ef32d823bfe7e2ee19a0dcc063e96203b610eda5aa81ede69776cfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Security for ezimage 0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.