Table of Contents
Shortcuts

# to_pil_image

torchvision.transforms.functional.to_pil_image(pic, mode=None)

  Convert a tensor or an ndarray to PIL Image. This function does not support torchscript.

  See `ToPILImage` for more details.

  Parameters:

    - pic (Tensor or numpy.ndarray) – Image to be converted to PIL Image.

    - mode (PIL.Image mode) – color space and pixel depth of input data (optional).

  Returns:

    Image converted to PIL Image.

  Return type:

    PIL Image

  Examples using `to_pil_image`:

  Visualization utilities

  Visualization utilities

## 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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.