Shortcuts

ImageReadMode

class torchvision.io.ImageReadMode(value)[source]

Allow automatic conversion to RGB, RGBA, etc while decoding.

Note

You don’t need to use this struct, you can just pass strings to all mode parameters, 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.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources