Skip to main content

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

Usage

Import imshow from imshowtools and use it like:

from imshowtools import imshow
imshow(lenna)

lenna

Advanced Usage

Colorspaces

OpenCV lover? imshowtools can also handle cv2's BGR images

import cv2
cv2image = cv2.imread('lenna.png')
imshow(cv2image)

lenna

cvshow(cv2image)                        # cvshow convenience function
imshow(cv2image, mode='BGR')            # imshow with mode

lenna

Tip: imshow can display [h, w, 1] shaped images as well in addition to [h, w] single channel images.

Show Multiple Images

imshow(image_1, image_2, image_3)

Show Multiple Images from List

imshow(*[my_image_list])

Example:

mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
[x_train.shape, y_train.shape], [x_test.shape, y_test.shape]
imshow(*x_train[:25])

mnist-25

Multiple images with colorspace:

imshow(*x_train[:100], cmap='gray')

mnist-100

Single Row and Single Column

imshow(*x_train[:16], cmap='binary', rows=1)

mnist-row

imshow(*x_train[:4], cmap='binary', columns=1)

mnist-column

Smart Wrapping / Custom Rows and Columns

imhow chooses the optimal layout:

  • Have 6 images? You get 2x3
  • Have 12 images? You get 3x4
  • Have 20 images? You get 4x5

You can also choose to manually control how many rows and columns you

imshow(*my_image_array, rows=3, columns=4)

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)

Uninstall

To uninstall imshowtools,

pip uninstall imshowtools

Contributing

Pull requests are very welcome.

  1. Fork the repo
  2. Create new branch with feature name as branch name
  3. Check if things work with a jupyter notebook
  4. Raise a pull request

Licence

Please see attached Licence

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

imshowtools-0.4.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imshowtools-0.4.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file imshowtools-0.4.0.tar.gz.

File metadata

  • Download URL: imshowtools-0.4.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for imshowtools-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3769db40b524203505a41541e333aa3c19286bbe3c8bb2ca32fbbbfe9d2c0348
MD5 3a85eba78455d1d3e1aca33d89bdac7f
BLAKE2b-256 cb2225d4dfb43a5a4ea0e18589df2bbebf863f5b2f4809cc0bce99207bebc81a

See more details on using hashes here.

File details

Details for the file imshowtools-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: imshowtools-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for imshowtools-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02f4f81929169329719e18ee4d69b84b14567183fc96e9c4e65144948cc96cee
MD5 4e9ee797c87c7ed1f33f7f8ad0313c79
BLAKE2b-256 ed4d86d01c190230f17c67cf94e5a0381f2e5f00c5b28d22da7b518e63c5b9a5

See more details on using hashes here.

Supported by

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