JPEG¶
- class torchvision.transforms.v2.JPEG(quality: Union[int, Sequence[int]])[source]¶
Apply JPEG compression and decompression to the given images.
If the input is a
torch.Tensor
, it is expected to be of dtype uint8, on CPU, and have […, 3 or 1, H, W] shape, where … means an arbitrary number of leading dimensions.- Parameters:
quality (sequence or number) – JPEG quality, from 1 to 100. Lower means more compression. If quality is a sequence like (min, max), it specifies the range of JPEG quality to randomly select from (inclusive of both ends).
- Returns:
image with JPEG compression.
Examples using
JPEG
:Illustration of transforms