mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 17:25:49 +03:00
Apply suggestions from code review
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
6b871fa18a
commit
36caa53fed
|
@ -502,7 +502,7 @@ in the current directory can be saved as JPEGs at reduced quality.
|
|||
|
||||
::
|
||||
|
||||
import os
|
||||
import glob
|
||||
from PIL import Image
|
||||
|
||||
|
||||
|
@ -513,12 +513,13 @@ in the current directory can be saved as JPEGs at reduced quality.
|
|||
img.save(dest_path, "JPEG", optimize=True, quality=80)
|
||||
|
||||
|
||||
paths = glob.glob(".png")
|
||||
paths = glob.glob("*.png")
|
||||
for path in paths:
|
||||
compress_image(path, path[:-4] + ".jpg")
|
||||
|
||||
Since images can also be opened from a ``Path`` from the ``pathlib`` module,
|
||||
the example could be modified to use ``pathlib`` instead of ``os``.
|
||||
the example could be modified to use ``pathlib`` instead of the ``glob``
|
||||
module.
|
||||
|
||||
::
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user