Image

class surfalize.image.Image(data)

Bases: object

Thin wrapper around numpy ndarray object representing an image. Provides methods to show and save the image to disk.

Methods

is_grayscale(array)

Determines whether a three dimensional array is grayscale by checking if all RGB channels have the same values.

save(path)

Save the image to disk using pillow.

show()

Constructs a pillow image from the underlying array and shows in Jupyter.

static is_grayscale(array)

Determines whether a three dimensional array is grayscale by checking if all RGB channels have the same values.

Parameters:
arrayndarray

ndarray of ndim 3.

Returns:
True if grayscale, else False
save(path)

Save the image to disk using pillow.

Parameters:
pathstr | Path

Path where the image should be saved. The extension determines the file format.

Returns:
None
show()

Constructs a pillow image from the underlying array and shows in Jupyter.

Returns:
PIL.Image