mistk.utils.image_utils module

mistk.utils.image_utils.dict_from_images(image_dir, valid_exts=['.jpeg', '.jpg', '.png'])

Builds a dict of decoded images (UTF-8) given a dir containing images

Parameters
  • image_dir – Path to the directory containing the desired image files

  • valid_exts – List of valid file extensions, in lower-case; defaults to [‘.jpeg’, ‘.jpg’, ‘.png’]

Returns

Dict of UTF-8 decoded images, keyed by image file name

mistk.utils.image_utils.encode_image(image_path)

Encodes an image file into a base64 bytes string

Parameters

image_path – Path to the image file to encode

Returns

A string representation (UTF-8) of image encoded in base64