polymerist.graphics.imageutils
Tools for editing and manipulating images, and image colors, sizes, and representations
Functions
|
Load an image from a bytestream |
|
Convert an image to a numpy array |
|
Takes an image and returns a pair of tuples containing the min and max non-background |
|
Takes an image and returns a 4-tuple of the coordinates of the tight bounding box based on a choice of background color |
|
Takes an image and returns an image with all extraneous borders of a particular background color cropped off |
Module Contents
- polymerist.graphics.imageutils.img_from_bytes(img_bytes: bytearray) PIL.Image.Image[source]
Load an image from a bytestream
- polymerist.graphics.imageutils.img_to_array(image: PIL.Image.Image, encoding: str = 'RGB') numpy.ndarray[source]
Convert an image to a numpy array
- polymerist.graphics.imageutils.get_axis_bounds(image: PIL.Image.Image, bg_color: int | tuple[int]) tuple[tuple[int, int], tuple[int, int]][source]
Takes an image and returns a pair of tuples containing the min and max non-background coordinates along the x- and y-axis (respectively) for some chosen background color