pythoshop.transform_image

Module Contents

Functions

transform_image(image[, method, direction, verbose])

Transform Image Function

pythoshop.transform_image.transform_image(image, method: str = 'rotate', direction: str = 'clockwise', verbose: bool = False)[source]

Transform Image Function This function takes a numpy image array and either rotates or flips the image in a specified direction.

Parameters:

  • image (numpy.ndarray): The input image array.

  • method (str, optional): The method to transform the image. ex: rotate, flip Options: ‘rotate’ (default) for rotating in the specified direction (clockwise or counterclockwise), ‘flip’ for flipping over the specified axis (horizontal or vertical).

  • direction (str, optional): The direction to transform the image. ex: (clockwise, counterclockwise,

    vertical, horizontal) Options: ‘clockwise’ and ‘counterclockwise’ for rotating an image, ‘vertical’ or ‘horizontal’ for the axis to flip the image over.

  • verbose (bool, optional): If True, print verbose information. False is the default.

Returns:

Image Numpy Array

The adjusted image, returned as a NumPy array.

raises ValueError:

If the method and direction are not compatible, ie method = ‘flip’, direction = ‘clockwise’, or the method or direction are not one of the options.

raises Example::

raises >>> image = mpimg.imread(‘path/to/input_image.jpg’):

raises >>> transform_image(image, method = ‘flip’, direction = ‘horizontal’, transpose = False):