util_img#

img conversion#

img_to_bytes(img_path)

Convert image to bytes.

img_PIL_to_bytes(img)

Convert PIL image to bytes.

img_CV_to_bytes(img)

Convert OpenCV numpy array to image bytes.

img_bytes_to_PIL(img_b)

Convert image bytes to PIL image.

img_bytes_to_CV(img_b)

Convert image bytes to OpenCV numpy array.

img operations#

is_PIL_img(img)

Check if the input object is a PIL image.

is_CV_img(img)

Check if the input object is a CV image.

img_PIL_to_CV(img)

Convert PIL image to CV image.

img_CV_to_PIL(img)

Convert CV image to PIL image.

img_translate(img, dx, dy[, verbose])

Translate image with a given distance in x-axis and y-axis.

img_rotate(img, angle[, center, scale, verbose])

Rotate image with a given angle at a given center.

img_rotate_bound(img, angle[, verbose])

Rotate image with a given angle, and keep the whole image in the frame.

img_resize(img[, width, height, inter, verbose])

Resize image.

img_show(img[, is_PIL_show, verbose])

Show image in a window from image path or image array or PIL image object.