[DEPRECATED] Decoding and Encoding images
The torchvision.io module provides utilities for decoding and encoding
images. For videos and audio, please use TorchCodec.
Image Decoding
Torchvision currently supports decoding JPEG, PNG, WEBP, GIF, AVIF, and HEIC images. JPEG decoding can also be done on CUDA GPUs.
The main entry point is the function, which
you can use as an alternative to . It will decode images
straight into image Tensors, thus saving you the conversion and allowing you to
run transforms/preproc natively on tensors.