imshowtools contains simplified imshow functions to show multiple images and with other options
Project description
imshowtools
This library lets you view images in Jupyter notebooks in a much simpler and intuitive way. Ships with a better 'imshow' function with Multi Images, Smart Wrap and BGR support!.
Installation
To install imshowtools
, simply do
pip install imshowtools
Quick Plot
Import imshow
from imshowtools
and use it:
from imshowtools import imshow
import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
imshow(x_train[0])
imshow(x_train[0], x_train[1], x_train[2])
imshow(*x_train[:20], cmap='binary')
imshow(*x_train[:100], cmap='binary')
You can use any matplotlib compatible cmap
Example ipynb notebook and Python along with test images provided in the example folder.
Get Numpy Image
You can use obtain numpy image in any of ['RGB', 'RGBA', 'ARGB', 'BW', 'L', "BGR", "BGRA", "ABGR"]
colorspaces.
image = imshow(*x_train[:100], return_image=True)
image = imshow(*x_train[:100], return_image="RGBA")
image = imshow(*x_train[:100], return_image="RGB")
image = imshow(*x_train[:100], return_image="BW")
print(image.shape)
# cv2.imwrite("saved_sample.png", image)
# do stuff with 'image' or even
# imshow(image)
Output:
(288, 432, 3)
(288, 432, 4)
(288, 432, 3)
(288, 432)
Rows and Columns
imshow(*x_train[:15], cmap='Purples', rows=1)
imshow(*x_train[:24], cmap='Greens', columns=4)
Open CV Images
lenna = cv2.imread('example/lenna.png')
imshow(lenna)
cvshow(lenna)
imshow(lenna, mode='BGR')
image = imshow(*[lenna for _ in range(12)], return_image="BW")
print(image.shape)
imshow(image)
Namespaces
If you do not want to use imshow
directly in your app (maybe you have another function named imshow), you shall use it like
import imshowtools
imshowtools.imshow(your_image)
or if you like to use a custom namespace
import imshowtools as my_namespace
my_namespace.imshow(your_image)
Contributing
Pull requests are very welcome.
- Fork the repo
- Create new branch with feature name as branch name
- Check if things work with a jupyter notebook
- Raise a pull request
Licence
Please see attached Licence
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
Hashes for imshowtools-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bbc5c6799bca3daf55113ca0d9cf0f674bae7882cb7f13eae206726e1752de4 |
|
MD5 | 57f817ba1f5d20b5a7e6cea78352c5b3 |
|
BLAKE2b-256 | b2edaee06b0919aa0d91fbce10c3475bc048401b94801fd03b01c299c2d019d0 |