GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Installation
  • Documentation
  • Examples
  • Tutorials
  • Contributing

This view

  • Original page
  • New address

GeezerVison is showing matplotlib.org — matplotlib.pyplot.imread — Matplotlib 3.1.2 documentation

You are reading an old version of the documentation (v3.1.1). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imread.html
Version 3.1.2
matplotlib
Fork me on GitHub

Navigation

  • index
  • modules |
  • next |
  • previous |
  • home| 
  • contents »
  • API Overview »
  • matplotlib.pyplot »
  • matplotlib.pyplot »

Quick search

Table of Contents

  • matplotlib.pyplot.imread
    • Examples using matplotlib.pyplot.imread

Related Topics

  • Documentation overview
    • API Overview
      • matplotlib.pyplot
        • matplotlib.pyplot
          • Previous: matplotlib.pyplot.hsv
          • Next: matplotlib.pyplot.imsave
Show Page Source

matplotlib.pyplot.imread¶

matplotlib.pyplot.imread(fname, format=None)[source]¶

Read an image from a file into an array.

Parameters:
fname : str or file-like

The image file to read: a filename, a URL or a file-like object opened in read-binary mode.

format : str, optional

The image file format assumed for reading the data. If not given, the format is deduced from the filename. If nothing can be deduced, PNG is tried.

Returns:
imagedata : numpy.array

The image data. The returned array has shape

  • (M, N) for grayscale images.
  • (M, N, 3) for RGB images.
  • (M, N, 4) for RGBA images.

Notes

Matplotlib can only read PNGs natively. Further image formats are supported via the optional dependency on Pillow. Note, URL strings are not compatible with Pillow. Check the Pillow documentation for more information.

Examples using matplotlib.pyplot.imread¶

../../_images/sphx_glr_image_clip_path_thumb.png

Clipping images with patches

../../_images/sphx_glr_image_demo_thumb.png

Image Demo

../../_images/sphx_glr_watermark_image_thumb.png

Watermark image

../../_images/sphx_glr_demo_annotation_box_thumb.png

Demo Annotation Box

../../_images/sphx_glr_demo_text_path_thumb.png

Demo Text Path

../../_images/sphx_glr_demo_ribbon_box_thumb.png

Ribbon Box

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2018 The Matplotlib development team.
Last updated on Jan 05, 2020. Created using Sphinx 1.8.5. Doc version v3.1.1-79-g90d53b526.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.