Skip to content

Commit d66f959

Browse files
committed
DOC: draft text on resampling
1 parent a5574f3 commit d66f959

File tree

1 file changed

+85
-3
lines changed

1 file changed

+85
-3
lines changed

doc/api/image_api.rst

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,89 @@
22
``matplotlib.image``
33
********************
44

5+
.. currentmodule:: matplotlib.image
6+
57
.. automodule:: matplotlib.image
6-
:members:
7-
:undoc-members:
8-
:show-inheritance:
8+
:no-members:
9+
:no-inherited-members:
10+
11+
12+
Image Artists
13+
-------------
14+
15+
.. inheritance-diagram:: matplotlib.image._ImageBase matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.PcolorImage matplotlib.image.AxesImage matplotlib.image.NonUniformImage
16+
:parts: 1
17+
:private-bases:
18+
19+
20+
.. autosummary::
21+
:toctree: _as_gen/
22+
:template: autosummary.rst
23+
24+
_ImageBase
25+
AxesImage
26+
NonUniformImage
27+
PcolorImage
28+
FigureImage
29+
BboxImage
30+
31+
32+
Resampling
33+
~~~~~~~~~~
34+
35+
When Matplotlib rasterizes an image when saving / displaying a Figure
36+
we need to, in general, resample the data (either up or down) in
37+
addition to normalizing and color mapping it. This is because the
38+
exact size of the input, in "data" pixels, will not match the size, in
39+
"screen" pixels, of the output. The details of how we do the
40+
resampling is controlled by the *interpolation* specified. This
41+
resampling process can introduce a variety of artifacts and the
42+
default interpolation is chosen to avoid aliasis in common cases (see
43+
:doc:`/gallery/images_contours_and_fields/image_antialiasing`).
44+
45+
Floating point and you
46+
----------------------
47+
48+
The processing steps for rendering a pseudo color image are:
49+
50+
1. rasample to user input to the required dimensions
51+
2. normalize the user data via a `~.colors.Normalize` instance
52+
3. color map from the normalized data to RGBA via a `~.colors.ColorMap` instance
53+
54+
Prior to Matplotlib 2.0 we re
55+
56+
57+
58+
Helper functions
59+
~~~~~~~~~~~~~~~~
60+
61+
62+
63+
.. autosummary::
64+
:toctree: _as_gen/
65+
:template: autosummary.rst
66+
67+
68+
composite_images
69+
pil_to_array
70+
71+
72+
73+
Image I/O functions
74+
-------------------
75+
76+
This functions can be used to read, save, and generate thumbnails of
77+
files on disk. These are here for historical reasons, and while it is
78+
unlikely we will remove them, please prefer to use a dedicated image
79+
I/O library (such as `imageio <https://imageio.github.io/>`__, `pillow
80+
<https://pillow.readthedocs.io/en/stable/>`__, or `tifffile
81+
<https://pypi.org/project/tifffile/>`__) instead.
82+
83+
84+
.. autosummary::
85+
:toctree: _as_gen/
86+
:template: autosummary.rst
87+
88+
imread
89+
imsave
90+
thumbnail

0 commit comments

Comments
 (0)