Fermer les images PIL et borner le cache de cartes de localisation

This commit is contained in:
Antoine Jacquin
2026-09-18 21:20:14 +02:00
parent 394dd27375
commit 5e13151998
2 changed files with 10 additions and 4 deletions

View File

@ -660,8 +660,8 @@ def generate_thumbnail(src_path, thumb_path, max_size=256, mid_path=None,
return source.resize((max(1, int(source.size[0] * scale)),
max(1, int(source.size[1] * scale))), resample)
img = PILImage.open(str(src_path))
img = img.convert('RGB')
with PILImage.open(str(src_path)) as _src_img:
img = _src_img.convert('RGB')
Path(thumb_path).parent.mkdir(parents=True, exist_ok=True)
if mid_path is not None:
try: