Python:Pillow .show()

JasperHC's avatar
Published Apr 8, 2025
Contribute to Docs

The .show() method in the Python Pillow library opens and displays an image using the system’s default image viewer. It’s a convenient way to quickly inspect images during development or testing without saving them to disk.

  • Machine Learning Data Scientists solve problems at scale, make predictions, find patterns, and more! They use Python, SQL, and algorithms.
    • Includes 27 Courses
    • With Professional Certification
    • Beginner Friendly.
      95 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

image.show(title=None, command=None)

Parameters

  • image: An instance of the Image class from the Pillow library.
  • title (Optional): A string specifying the window title (may not work on all platforms).
  • command (Optional): A shell command specifying an alternative image display method. This is rarely needed in typical use cases.

Example

The following example opens and displays an image file, example.jpg, using the system’s default image viewer:

from PIL import Image
# Open an existing image
image = Image.open("example.jpg")
# Display the image
image.show()

All contributors

Contribute to Docs

Learn Python:Pillow on Codecademy

  • Machine Learning Data Scientists solve problems at scale, make predictions, find patterns, and more! They use Python, SQL, and algorithms.
    • Includes 27 Courses
    • With Professional Certification
    • Beginner Friendly.
      95 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours