{"id":9213,"date":"2021-02-22T14:40:00","date_gmt":"2021-02-22T09:10:00","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/?p=9213"},"modified":"2021-06-14T15:45:01","modified_gmt":"2021-06-14T10:15:01","slug":"matplotlib-imread","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/matplotlib-imread\/","title":{"rendered":"Matplotlib Imread: Illustration and Examples"},"content":{"rendered":"\n<p>Hello coders!! In this article, we will be learning about matplotlib imread. We will learn about its syntax and then see some illustrated examples. Without wasting any time, let us get straight into the topic.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#matplotlibpyplotimread_Function\" title=\"matplotlib.pyplot.imread() Function:\">matplotlib.pyplot.imread() Function:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Illustrated_Examples\" title=\"Illustrated Examples:\">Illustrated Examples:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Example_1_Loading_Image\" title=\"Example 1: Loading Image:\">Example 1: Loading Image:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Example_2_Watermark_Image_using_matplotlib_imread\" title=\"Example 2: Watermark Image using matplotlib imread:\">Example 2: Watermark Image using matplotlib imread:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Example_3_Clipping_Image_With_Patches\" title=\"Example 3: Clipping Image With Patches:\">Example 3: Clipping Image With Patches:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Example_4_Matplotlib_imread_grayscale\" title=\"Example 4: Matplotlib imread\u00a0grayscale:\">Example 4: Matplotlib imread\u00a0grayscale:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Example_5_Matplotlib_imread_RGB\" title=\"Example 5: \u00a0Matplotlib imread\u00a0RGB:\">Example 5: \u00a0Matplotlib imread\u00a0RGB:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Specify_the_type_of_image_in_matplotlib_imread\" title=\"Specify the type of image in matplotlib imread:\">Specify the type of image in matplotlib imread:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Matplotlib_imread_vs_cv2_imread\" title=\"Matplotlib imread vs cv2 imread:\">Matplotlib imread vs cv2 imread:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Also_Read\" title=\"Also, Read\">Also, Read<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#Conclusion\" title=\"Conclusion:\">Conclusion:<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-matplotlib-pyplot-imread-function\"><span class=\"ez-toc-section\" id=\"matplotlibpyplotimread_Function\"><\/span>matplotlib.pyplot.imread() Function:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This method is used to read an image from a file into an array. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-syntax-matplotlib-imread\">Syntax Matplotlib Imread:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>matplotlib.pyplot.imread(fname, format=None)<\/strong><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-parameters\">Parameters:<\/h3>\n\n\n\n<ul><li><strong>fname :&nbsp;<\/strong> image file <\/li><li><strong>format:&nbsp;<\/strong>image file format<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-return-value-of-matplotlib-imread\">Return Value of Matplotlib Imread:<\/h3>\n\n\n\n<p>This method returns the image data.<\/p>\n\n\n\n<p>The image data. The returned array has shape<\/p>\n\n\n\n<ul><li>Grayscale images: (M, N) <\/li><li>RGB images: (M, N, 3) <\/li><li>RGBA images: (M, N, 4)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-illustrated-examples\"><span class=\"ez-toc-section\" id=\"Illustrated_Examples\"><\/span>Illustrated Examples:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let us now look into some examples to grasp a clearer concept.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-1-loading-image\"><span class=\"ez-toc-section\" id=\"Example_1_Loading_Image\"><\/span>Example 1: Loading Image:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np \nimport matplotlib.cbook as cbook \nimport matplotlib.image as image \nimport matplotlib.pyplot as plt \n\nwith cbook.get_sample_data('img.jpg') as image_file: \n\timage = plt.imread(image_file) \n\nfig, ax = plt.subplots() \nax.imshow(image) \nax.axis('off') \n\n\nplt.show() \n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"304\" height=\"231\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-27.png\" alt=\"Loading Image\" class=\"wp-image-9218\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-27.png 304w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-27-300x228.png 300w\" sizes=\"(max-width: 304px) 100vw, 304px\" \/><figcaption><strong><em>Output<\/em><\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>cbook.get_sample_data() method is used to get the sample data file. Sample data files are stored in the &#8216;mpl-data\/sample_data&#8217; directory within the Matplotlib package. We then used the imread() method to return the image file. Lastly, using the imshow() method, we displayed the output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-2-watermark-image-using-matplotlib-imread\"><span class=\"ez-toc-section\" id=\"Example_2_Watermark_Image_using_matplotlib_imread\"><\/span>Example 2: Watermark Image using matplotlib imread:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np \nimport matplotlib.cbook as cbook \nimport matplotlib.image as image \nimport matplotlib.pyplot as plt \n\n\nwith cbook.get_sample_data('img.jpg') as file: \n\tim = image.imread(file) \n\nfig, ax = plt.subplots() \n\nax.plot(np.sin(10 * np.linspace(0, 1)), '-o', ms = 15,alpha = 0.6, mfc ='green') \n\n\nfig.figimage(im, 5, 5, zorder = 3, alpha =.5) \n\n\nplt.show() \n\n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"386\" height=\"248\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-30.png\" alt=\"Watermark Image using matplotlib imread\" class=\"wp-image-9221\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-30.png 386w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-30-300x193.png 300w\" sizes=\"(max-width: 386px) 100vw, 386px\" \/><figcaption><strong><em>Output<\/em><\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>As you can see, in this example, we have used the same image as a background and plotted the sine function curve over it.  We used the same steps as the previous example to load and display the image. We then plotted the sin method over it using the numpy sin method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-3-clipping-image-with-patches\"><span class=\"ez-toc-section\" id=\"Example_3_Clipping_Image_With_Patches\"><\/span>Example 3: Clipping Image With Patches:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as patches\nimport matplotlib.cbook as cbook\n\n\nwith cbook.get_sample_data('img.jpg') as image_file:\n    image = plt.imread(image_file)\n\nfig, ax = plt.subplots()\nim = ax.imshow(image)\npatch = patches.Circle((100, 100), radius=90, transform=ax.transData)\nim.set_clip_path(patch)\n\nax.axis('off')\nplt.show()\n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"304\" height=\"231\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-37.png\" alt=\"Clipping Image\" class=\"wp-image-9257\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-37.png 304w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-37-300x228.png 300w\" sizes=\"(max-width: 304px) 100vw, 304px\" \/><figcaption><strong><em>Output<\/em><\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>In this example, we have clipped our image. Just like the previous examples, we used the cbook.get_sample_data() method to load our image.  We then used <a href=\"https:\/\/matplotlib.org\/3.1.1\/api\/_as_gen\/matplotlib.patches.Circle.html\" target=\"_blank\" rel=\"noreferrer noopener\">patches.Circle() <\/a>method to create a circle at the center (100,100) and radius 90. Using the set_clip_path() method is used to set the artist\u2019s clip-path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-4-matplotlib-imread-grayscale\"><span class=\"ez-toc-section\" id=\"Example_4_Matplotlib_imread_grayscale\"><\/span>Example 4: Matplotlib imread\u00a0grayscale:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt\nimport matplotlib.image as img\n\nimage = img.imread('img.jpg')\n\nplt.imshow(image&#x5B;:,:,1], cmap='gray')\nplt.show()\n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"330\" height=\"252\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-47.png\" alt=\"Matplotlib imread\" class=\"wp-image-9373\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-47.png 330w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-47-300x229.png 300w\" sizes=\"(max-width: 330px) 100vw, 330px\" \/><figcaption><strong><em>Output<\/em><\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>For this code, we have converted the image into grayscale. Like the previous examples, we use the imread() method to read the image file. We then slice the array and use <a href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\" target=\"_blank\" rel=\"noreferrer noopener\">cmap<\/a> gray to convert our image to grayscale.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-5-matplotlib-imread-rgb\"><span class=\"ez-toc-section\" id=\"Example_5_Matplotlib_imread_RGB\"><\/span>Example 5: \u00a0Matplotlib imread\u00a0RGB:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt\nimport matplotlib.image as img\nimage = img.imread(&quot;img.jpg&quot;)\nplt.imshow(image)\nplt.show()\n<\/pre><\/div>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"330\" height=\"252\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-48.png\" alt=\"RGB\" class=\"wp-image-9374\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-48.png 330w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/image-48-300x229.png 300w\" sizes=\"(max-width: 330px) 100vw, 330px\" \/><figcaption><strong><em>Output<\/em><\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>Here, we have loaded the image using matplotlib imread in RGB format. We then used the imshow() method to display the loaded image.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-specify-the-type-of-image-in-matplotlib-imread\"><span class=\"ez-toc-section\" id=\"Specify_the_type_of_image_in_matplotlib_imread\"><\/span>Specify the type of image in matplotlib imread:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As discussed earlier, the syntax of imread is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>matplotlib.pyplot.imread(fname, format=None)<\/strong><\/pre>\n\n\n\n<p>The format parameter specifies&nbsp;the image file format that will be assumed for reading the data. &nbsp;If not given, the format is deduced from the filename. If nothing can be deduced, PNG is tried.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-matplotlib-imread-vs-cv2-imread\"><span class=\"ez-toc-section\" id=\"Matplotlib_imread_vs_cv2_imread\"><\/span>Matplotlib imread vs cv2 imread:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong><span style=\"text-decoration: underline\">Matplotlib imread<\/span><\/strong><\/td><td><strong><span style=\"text-decoration: underline\">CV2 imread<\/span><\/strong><\/td><\/tr><tr><td>Reads color value as RGB<\/td><td>Reads color value as BGR<\/td><\/tr><tr><td>Lists pixel rows from the bottom to the top<\/td><td>Lists pixel rows from the top to bottom<\/td><\/tr><tr><td>Less efficient<\/td><td>More efficient<\/td><\/tr><tr><td><code>matplotlib_img=img.imread('img.jpg')<br>plt.imshow(matplotlib_img)<\/code><\/td><td><code>cv_img=cv2.imread('img.jpg')<br>plt.imshow(cv_img)<\/code><\/td><\/tr><tr><td><img decoding=\"async\" width=\"150\" height=\"115\" class=\"wp-image-9395\" style=\"width: 150px;\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread.png\" alt=\"matplotlib imread\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread.png 330w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-300x229.png 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/td><td><img decoding=\"async\" width=\"150\" height=\"115\" class=\"wp-image-9394\" style=\"width: 150px;\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/cv2-imread.png\" alt=\"cv2 imread\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/cv2-imread.png 330w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/cv2-imread-300x229.png 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" id=\"h-also-read\" style=\"color:#027e25\"><span class=\"ez-toc-section\" id=\"Also_Read\"><\/span>Also, Read<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links\"><li><a href=\"https:\/\/www.pythonpool.com\/cv2-imshow\/\">What is cv2 imshow()? Explained with examples<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/cv2-normalize\/\">CV2 Normalize() in Python Explained With Examples<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\">How to Display Images Using Matplotlib Imshow Function<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/matplotlib-gca\/\">Matplotlib GCA in Python Explained with Examples<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/cv2-boundingrect\/\">CV2 Boundingrect Explained with Examples<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With this, we come to an end with this article. I hope that the concept of matplotlib imread was clarified from this article. It is essentially useful when we want to implement an image into our graphical representation.<\/p>\n\n\n\n<p>However, if you have any doubts or questions, do let me know in the comment section below. I will try to help you as soon as possible.<\/p>\n\n\n\n<p><strong><em>Happy Pythoning!<\/em><\/strong><\/p>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello coders!! In this article, we will be learning about matplotlib imread. We will learn about its syntax and then see some illustrated examples. Without &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Matplotlib Imread: Illustration and Examples\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imread\/#more-9213\" aria-label=\"More on Matplotlib Imread: Illustration and Examples\">Read more<\/a><\/p>\n","protected":false},"author":12,"featured_media":9401,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2071],"tags":[3649,3647,3646,3651,3648,3650],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Matplotlib Imread: Illustration and Examples - Python Pool<\/title>\n<meta name=\"description\" content=\"Matplotlib imread method is used to read an image from a file into an array. Syntax: matplotlib.pyplot.imread(fname, format=None)\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Matplotlib Imread: Illustration and Examples\" \/>\n<meta property=\"og:description\" content=\"Hello coders!! In this article, we will be learning about matplotlib imread. We will learn about its syntax and then see some illustrated examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-22T09:10:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-14T10:15:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com.dream.website\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Prachee Sao\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prachee Sao\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\"},\"author\":{\"name\":\"Prachee Sao\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/b91d749826b21e606d55cda77d51ef47\"},\"headline\":\"Matplotlib Imread: Illustration and Examples\",\"datePublished\":\"2021-02-22T09:10:00+00:00\",\"dateModified\":\"2021-06-14T10:15:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\"},\"wordCount\":557,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png\",\"keywords\":[\"cv2.imread matplotlib\",\"imread matplotlib\",\"matplotlib imread and imshow\",\"matplotlib vs opencv imread time\",\"plt imread resolution matplotlib\",\"specify type of image in matplotlib imread\"],\"articleSection\":[\"Matplotlib\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\",\"url\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\",\"name\":\"Matplotlib Imread: Illustration and Examples - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png\",\"datePublished\":\"2021-02-22T09:10:00+00:00\",\"dateModified\":\"2021-06-14T10:15:01+00:00\",\"description\":\"Matplotlib imread method is used to read an image from a file into an array. Syntax: matplotlib.pyplot.imread(fname, format=None)\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png\",\"width\":1350,\"height\":650,\"caption\":\"matplotlib imread\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Matplotlib Imread: Illustration and Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/b91d749826b21e606d55cda77d51ef47\",\"name\":\"Prachee Sao\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/969eb9ba38e0aa5c3175935da2455ac7?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/969eb9ba38e0aa5c3175935da2455ac7?s=96&d=wavatar&r=g\",\"caption\":\"Prachee Sao\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Matplotlib Imread: Illustration and Examples - Python Pool","description":"Matplotlib imread method is used to read an image from a file into an array. Syntax: matplotlib.pyplot.imread(fname, format=None)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/","og_locale":"en_US","og_type":"article","og_title":"Matplotlib Imread: Illustration and Examples","og_description":"Hello coders!! In this article, we will be learning about matplotlib imread. We will learn about its syntax and then see some illustrated examples.","og_url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/","og_site_name":"Python Pool","article_published_time":"2021-02-22T09:10:00+00:00","article_modified_time":"2021-06-14T10:15:01+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png","type":"image\/png"}],"author":"Prachee Sao","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Prachee Sao","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/"},"author":{"name":"Prachee Sao","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#\/schema\/person\/b91d749826b21e606d55cda77d51ef47"},"headline":"Matplotlib Imread: Illustration and Examples","datePublished":"2021-02-22T09:10:00+00:00","dateModified":"2021-06-14T10:15:01+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/"},"wordCount":557,"commentCount":0,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png","keywords":["cv2.imread matplotlib","imread matplotlib","matplotlib imread and imshow","matplotlib vs opencv imread time","plt imread resolution matplotlib","specify type of image in matplotlib imread"],"articleSection":["Matplotlib"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/","name":"Matplotlib Imread: Illustration and Examples - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png","datePublished":"2021-02-22T09:10:00+00:00","dateModified":"2021-06-14T10:15:01+00:00","description":"Matplotlib imread method is used to read an image from a file into an array. Syntax: matplotlib.pyplot.imread(fname, format=None)","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/matplotlib-imread-1.png","width":1350,"height":650,"caption":"matplotlib imread"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com.dream.website\/matplotlib-imread\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Matplotlib Imread: Illustration and Examples"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#\/schema\/person\/b91d749826b21e606d55cda77d51ef47","name":"Prachee Sao","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/secure.gravatar.com\/avatar\/969eb9ba38e0aa5c3175935da2455ac7?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/secure.gravatar.com\/avatar\/969eb9ba38e0aa5c3175935da2455ac7?s=96&d=wavatar&r=g","caption":"Prachee Sao"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9213"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=9213"}],"version-history":[{"count":19,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9213\/revisions"}],"predecessor-version":[{"id":13585,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9213\/revisions\/13585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/9401"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=9213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=9213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=9213"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926025550\/https:\/\/api.w.org\/{rel}","templated":true}]}}