Skip to content

Commit

Permalink
Added thumbnail() demonstration image
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 27, 2023
1 parent ac9d818 commit ac86175
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Binary file added docs/example/image_thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 12 additions & 7 deletions docs/reference/ImageOps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ Resize relative to a given size
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 |
+------+------------+-------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+
# thumbnail() can also be used,
# but will modify the image object in place
im.thumbnail(size)
im.save("imageops_pad.png")

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

.. autofunction:: contain
.. autofunction:: cover
Expand Down

0 comments on commit ac86175

Please sign in to comment.