decode_jpeg
- torchvision.io.decode_jpeg(input: Union[Tensor, list[torch.Tensor]], mode: ImageReadMode =, ,
[DEPRECATED] Use TorchCodec instead.
Decode JPEG image(s) into 3D RGB or grayscale Tensor(s), on CPU or CUDA.
The values of the output tensor are uint8 between 0 and 255.
input (Tensor[1] or list[Tensor[1]]) – a (list of) one dimensional uint8 tensor(s) containing
the raw bytes of the JPEG image. The tensor(s) must be on CPU,
regardless of the device parameter.
mode (str or ImageReadMode) – The mode to convert the image to, e.g. “RGB”.
Default is “UNCHANGED”. See ImageReadMode
for available modes.
device (str or ) –
The values of the output tensor(s) are uint8 between 0 and 255.
output.device will be set to the specified device
output (Tensor[image_channels, image_height, image_width] or list[Tensor[image_channels, image_height, image_width]])
The device on which the decoded image will be stored. If a cuda device is specified, the image will be decoded with nvjpeg.
apply_exif_orientation (bool) – apply EXIF orientation transformation to the output tensor. Default: False. Only implemented for JPEG format on CPU.