ImageReadMode¶
- class torchvision.io.ImageReadMode(value)[source]¶
[DEPRECATED] Use TorchCodec instead.
Allow automatic conversion to RGB, RGBA, etc while decoding.
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.
Note
You don’t need to use this struct, you can just pass strings to all
modeparameters, e.g.mode="RGB".The different available modes are the following.
UNCHANGED: loads the image as-is
RGB: converts to RGB
RGBA: converts to RGB with transparency (also aliased as RGB_ALPHA)
GRAY: converts to grayscale
GRAY_ALPHA: converts to grayscale with transparency
Note
Some decoders won’t support all possible values, e.g. GRAY and GRAY_ALPHA are only supported for PNG and JPEG images.