readImageAsBase64

emlib.img.readImageAsBase64(imgpath, outformat='', removeAlpha=False)[source]

Read an image and output its base64 representation

Parameters:
  • imgpath (str) – the path to the image

  • outformat – the format to save the image to

  • removeAlpha – if True, remove alpha channel

Return type:

tuple[bytes, int, int]

Returns:

a tuple (data, width, height), where data is the base64 representation of the image, as bytes