viam.media.utils.pil.viam_rgba_plugin

Classes

RGBAEncoder

Python implementation of a format encoder. Override this class and

RGBAImage

Base class for image file format handlers.

RGBADecoder

Python implementation of a format decoder. Override this class and

Module Contents

class viam.media.utils.pil.viam_rgba_plugin.RGBAEncoder(mode, *args)[source]

Bases: PIL.ImageFile.PyEncoder

Python implementation of a format encoder. Override this class and add the decoding logic in the encode() method.

See Writing Your Own File Codec in Python

ENCODER_NAME
encode(bufsize)[source]

Override to perform the encoding process.

Parameters:

bufsize – Buffer size.

Returns:

A tuple of (bytes encoded, errcode, bytes). If finished with encoding return 1 for the error code. Err codes are from ImageFile.ERRORS.

class viam.media.utils.pil.viam_rgba_plugin.RGBAImage(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

Base class for image file format handlers.

format: ClassVar[str]
format_description = "Viam's Raw RGBA Format"
close() None

Closes the file pointer, if possible.

This operation will destroy the image core and release its memory. The image data will be unusable afterward.

This function is required to close images that have multiple frames or have not had their file read and closed by the load() method. See file-handling for more information.

class viam.media.utils.pil.viam_rgba_plugin.RGBADecoder(mode, *args)[source]

Bases: PIL.ImageFile.PyDecoder

Python implementation of a format decoder. Override this class and add the decoding logic in the decode() method.

See Writing Your Own File Codec in Python

decode(buffer) Tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.