write_jpeg¶
- torchvision.io.write_jpeg(input: Tensor, filename: str, quality: int = 75) Tensor[source]¶
[DEPRECATED] Use TorchCodec instead.
Takes an input tensor in CHW layout and saves it in a JPEG file.
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.
- Parameters:
input (Tensor[channels, image_height, image_width]) – int8 image tensor of
cchannels, wherecmust be 1 or 3.filename (str or
pathlib.Path) – Path to save the image.quality (int) – Quality of the resulting JPEG file, it must be a number between 1 and 100. Default: 75
- Returns:
the JPEG-encoded data that was written to the file.
- Return type:
output (Tensor)