Skip to content

Commit

Permalink
Added demonstration images to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 26, 2023
1 parent 80dbd3b commit 08c69ba
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
Binary file added docs/example/imageops_contain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/example/imageops_cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/example/imageops_fit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/example/imageops_pad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 26 additions & 4 deletions docs/reference/ImageOps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,41 @@ only work on L and RGB images.

.. autofunction:: autocontrast
.. autofunction:: colorize
.. autofunction:: contain
.. autofunction:: cover
.. autofunction:: pad
.. autofunction:: crop
.. autofunction:: scale
.. autofunction:: deform
.. autofunction:: equalize
.. autofunction:: expand
.. autofunction:: fit
.. autofunction:: flip
.. autofunction:: grayscale
.. autofunction:: invert
.. autofunction:: mirror
.. autofunction:: posterize
.. autofunction:: solarize
.. autofunction:: exif_transpose

Resize relative to a given size
-------------------------------

::

from PIL import Image, ImageOps
size = (100, 150)
with Image.open("Tests/images/hopper.png") as im:
ImageOps.contain(im, size).save("imageops_contain.png")
ImageOps.cover(im, size).save("imageops_cover.png")
ImageOps.fit(im, size).save("imageops_fit.png")
ImageOps.pad(im, size, color="#f00").save("imageops_pad.png")

+------+--------------------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+
| | :meth:`contain` | :meth:`cover` | :meth:`fit` | :meth:`pad` |
+======+============================================+==========================================+========================================+========================================+
|Size | (100, 100) | (150, 150) | (150, 100) | (150, 100) |
+------+--------------------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+
|Image | .. image:: ../example/imageops_contain.png | .. image:: ../example/imageops_cover.png | .. image:: ../example/imageops_fit.png | .. image:: ../example/imageops_pad.png |
+------+------------+-------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+

.. autofunction:: contain
.. autofunction:: cover
.. autofunction:: fit
.. autofunction:: pad

0 comments on commit 08c69ba

Please sign in to comment.