Shortcuts

decode_gif

torchvision.io.decode_gif(input: Tensor) Tensor[source]

[DEPRECATED] Use TorchCodec instead.

Decode a GIF image into a 3 or 4 dimensional RGB Tensor.

Warning

The image decoding and encoding capabilities of TorchVision are deprecated since torchvision 0.29 and will be removed in a future release. They are superseded by the more complete decoders and encoders of TorchCodec (from torchcodec 0.16). Please see this migration guide on how to migrate your code.

The values of the output tensor are uint8 between 0 and 255. The output tensor has shape (C, H, W) if there is only one image in the GIF, and (N, C, H, W) if there are N images.

Parameters:

input (Tensor[1]) – a one dimensional contiguous uint8 tensor containing the raw bytes of the GIF image.

Returns:

output (Tensor[image_channels, image_height, image_width] or Tensor[num_images, image_channels, image_height, image_width])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources