{ "cells": [ { "cell_type": "markdown", "id": "6838b2de", "metadata": {}, "source": [ "# Hello" ] }, { "cell_type": "code", "execution_count": null, "id": "4200d243", "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", " Example to read a image file using the matplotlib image module\n", " and display it. It will work with all common image formats\n", "\n", " Try with the supplied \"stones.jpg\" file. (stones on a Scottish beach)\n", "\"\"\"\n", "\n", "import matplotlib.pyplot as plt\n", "import matplotlib.image as img # Import image module\n", "\n", "def main():\n", " filename = str(input(\"Graphics file : \"))\n", "\n", " image = img.imread(filename) # Read the jpeg\n", " plt.imshow(image) # render it in plot axis\n", " plt.show() # display it\n", "\n", "main()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }