{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Read Image Files\n\nRead and plot image files (JPEG, TIFF, PNG, etc).\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from pyvista import examples"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "PyVista fully supports reading images into their own spatially\nreferenced data objects (this example) as well as supports texture\nmapping of images onto datasets (see `texture_example`{.interpreted-text\nrole=\"ref\"}).\n\nDownload a JPEG image of a puppy and load it to\n`pyvista.ImageData`{.interpreted-text role=\"class\"}. This could\nsimilarly be implemented with any image file by using the\n`pyvista.read`{.interpreted-text role=\"func\"} function and passing the\npath to the image file.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "image = examples.download_puppy()\n# or...\n# image = pv.read('my_image.jpg')"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "When plotting images stored in `pyvista.ImageData`{.interpreted-text\nrole=\"class\"} objects, it is important to specify using the\n[rgb]{.title-ref} option when plotting to ensure that the image\\'s true\ncolors are used and not mapped.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# True image colors\nimage.plot(rgb=True, cpos=\"xy\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Mapped image colors\nimage.plot(cpos=\"xy\")"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "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.12.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}