Reduire resolution max photos DSLR a 2000px (plus rapide)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -159,12 +159,12 @@ class Camera:
|
|||||||
tmp_path = str(chemin_dest) + ".tmp"
|
tmp_path = str(chemin_dest) + ".tmp"
|
||||||
fichier_camera.save(tmp_path)
|
fichier_camera.save(tmp_path)
|
||||||
|
|
||||||
# Redimensionner si trop gros (max 3000px de large, JPEG 92%)
|
# Redimensionner (max 2000px de large, JPEG 90%)
|
||||||
img = PILImage.open(tmp_path)
|
img = PILImage.open(tmp_path)
|
||||||
if img.width > 3000:
|
if img.width > 2000:
|
||||||
ratio = 3000 / img.width
|
ratio = 2000 / img.width
|
||||||
img = img.resize((3000, int(img.height * ratio)), PILImage.LANCZOS)
|
img = img.resize((2000, int(img.height * ratio)), PILImage.LANCZOS)
|
||||||
img.save(str(chemin_dest), "JPEG", quality=92)
|
img.save(str(chemin_dest), "JPEG", quality=90)
|
||||||
Path(tmp_path).unlink(missing_ok=True)
|
Path(tmp_path).unlink(missing_ok=True)
|
||||||
|
|
||||||
log.info(f"Photo capturee (DSLR) : {chemin_dest} ({img.width}x{img.height})")
|
log.info(f"Photo capturee (DSLR) : {chemin_dest} ({img.width}x{img.height})")
|
||||||
|
|||||||
Reference in New Issue
Block a user