mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
6c8ac0e700
commit
cd613e6850
|
@ -513,7 +513,7 @@ in the current directory can be saved as JPEGs at reduced quality.
|
|||
img.save(dest_path, "JPEG", optimize=True, quality=80)
|
||||
|
||||
|
||||
paths = [path for path in os.listdir(".") if path.endsWith(".png")]
|
||||
paths = glob.glob(".png")
|
||||
for path in paths:
|
||||
compress_image(path, path[:-4] + ".jpg")
|
||||
|
||||
|
@ -524,7 +524,7 @@ the example could be modified to use ``pathlib`` instead of ``os``.
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
paths = [path for path in Path.cwd().iterdir() if path.suffix == ".png"]
|
||||
paths = Path(".").glob("*.png")
|
||||
for path in paths:
|
||||
compress_image(path, filepath.stem + ".jpg")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user