Image

Utilities for image handling.

Serializer for images.

class mauzr.util.image.serializer.ImageSerializer(fmt)

Bases: object

Serialize images with pillow.

Parameters:fmt (str) – Image format. See PIL.Image.Image
pack(image)
Parameters:image (PIL.Image.Image) – Image to pack.
Returns:Packed image.
Return type:bytes
static unpack(data)
Parameters:data (bytes) – Packed image.
Returns:Unpacked image.
Return type:PIL.Image
class mauzr.util.image.serializer.SurfaceSerializer

Bases: object

Serialize images for pygame.

static pack(image)

Pack is not implemented for surfaces.

static unpack(data)
Parameters:data (bytes) – Packed image.
Returns:Unpacked image.
Return type:pygame.Surface

Functions helping to view images.

class mauzr.util.image.viewer.Viewer(core, tkroot, cfgbase='viewer', **kwargs)

Bases: object

Display an image stream via GUI.

Parameters:
  • core (object) – Core instance.
  • tkroot (tkinter.Tk) – GUI root.
  • cfgbase (str) – Configuration entry for this unit.
  • kwargs (dict) – Keyword arguments that will be merged into the config.

Required core units:

  • mqtt

Configuration:

  • topic (str) - Input topic.
  • scale (float) - Scaling factor applied to the image before displaying.
  • mode (str) - Image format. See PIL.Image.Image.

Input topics:

  • topic: Topic to receive images by (mode set by mode).
mauzr.util.image.viewer.main()

Entry point for the image viewer.