tfmri.io.encode_gif

encode_gif(image, loop_count=0, name=None)[source]

Encode a uint8 tensor to gif image with extensions.

Based on tfio.image.encode_gif, but also supports grayscale images and looping extension.

Parameters
  • image – A uint8 tensor with shape [N, H, W, C], where C must be 1 or 3 (grayscale, RGB).

  • loop_count – Number of times the animation should be looped. Set to 0 for endless looping.

  • name – A name for the operation.

Returns

A tensor of type string with the encoded bytes.

Raises

ValueError – If loop_count is not in the range [0, 65535].