Added thumbnail() demonstration image

This commit is contained in:
Andrew Murray 2023-09-28 08:17:06 +10:00
parent ac9d8180a3
commit ac86175491
2 changed files with 12 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -40,13 +40,18 @@ Resize relative to a given size
ImageOps.fit(im, size).save("imageops_fit.png") ImageOps.fit(im, size).save("imageops_fit.png")
ImageOps.pad(im, size, color="#f00").save("imageops_pad.png") ImageOps.pad(im, size, color="#f00").save("imageops_pad.png")
+------+--------------------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+ # thumbnail() can also be used,
| | :meth:`contain` | :meth:`cover` | :meth:`fit` | :meth:`pad` | # but will modify the image object in place
+======+============================================+==========================================+========================================+========================================+ im.thumbnail(size)
|Size | (100, 100) | (150, 150) | (150, 100) | (150, 100) | im.save("imageops_pad.png")
+------+--------------------------------------------+------------------------------------------+----------------------------------------+----------------------------------------+
|Image | .. image:: ../example/imageops_contain.png | .. image:: ../example/imageops_cover.png | .. image:: ../example/imageops_fit.png | .. image:: ../example/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:: contain
.. autofunction:: cover .. autofunction:: cover