RestOC.Image module

Image

Module to manipulate images and photos, requires the Python Pillow library

RestOC.Image.apply_rotation(image)

Apply Rotation

Uses exif data to rotate the image to the proper position

Parameters

image (str) – A raw image as a string

Returns

str

RestOC.Image.convertToJPEG(image)

Convert To JPEG

Changes any valid image into a JPEG

Parameters

image (str) – A raw image as a string

Returns

str

RestOC.Image.info(image)

Info

Returns information about an image: resolution, length, type, and mime

Parameters

image (str) – A raw image as a string

Returns

dict

RestOC.Image.resize(image, dims, crop=False)

Resize

Given raw data and a size, a new image is created and returned as raw data

Parameters
  • image (str) – Raw image data to be loaded and resized

  • dims (str|dict) – New dimensions of the image, “WWWxHHH” or {“w”:, “h”:}

  • crop (bool) – Set to true to crop the photo rather than add whitespace

Returns

str