"""Images ajoutées au site (horizon lointain, lot 10, lot 11) : captures UiShot → img/*.jpg"""
import os
from PIL import Image

S = r"C:\Users\Admin\AppData\Local\Temp\claude\C--Users-Admin-Documents-claude\5b795b82-5358-4832-a412-2d7f9e896f9c\scratchpad"
L10 = os.path.join(S, "lot10", "final", "uishot_gfx_%s.png")
L11 = os.path.join(S, "lot11", "v2", "uishot_gfx_%s.png")
V1 = os.path.join(S, "lot11", "v1", "uishot_gfx_%s.png")
jobs = {  # nom de sortie : (source, recadrage ou None)
    "lointain": (L11 % "lointain", None), "lointain_off": (L11 % "lointain_off", None),
    "lointain_soir": (L11 % "lointain_soir", None), "lointain_nord": (L10 % "lointain_nord", None),
    "pregen": (os.path.join(S, "lot10", "final", "uishot_cmd_lointain.png"), (0, 580, 440, 827)),
    "brume_matin": (L11 % "brume_matin", None), "brume_matin_off": (L11 % "brume_matin_off", None),
    "brume_matin_haut": (L11 % "brume_matin_haut", None),
    "neige": (L10 % "neige", None), "neige_nuit": (L10 % "neige_nuit", None), "neige_traces": (L10 % "neige_traces", None),
    "neige_haut": (L10 % "neige_haut", None), "neige_souffle": (L10 % "neige_souffle", (560, 270, 1120, 585)),
    "alerte": (L10 % "alerte", None), "alerte_haut": (L10 % "alerte_haut", (360, 0, 1240, 495)),
    "couvrefeu": (L10 % "couvrefeu", None), "couvrefeu_haut": (L10 % "couvrefeu_haut", (360, 0, 1240, 495)),
    "drones": (L10 % "drones", None),
    "cdf": (L11 % "cdf", None), "cdf_off": (L11 % "cdf_off", None), "cdf_nuit": (L11 % "cdf_nuit", None),
    "chaleur": (L11 % "chaleur", None), "chaleur_off": (L11 % "chaleur_off", None),
    "ko": (V1 % "ko", None), "ko_fin": (V1 % "ko_fin", None), "blesse": (V1 % "blesse", None),
}
total = 0
os.makedirs("img", exist_ok=True)
for name, (src, box) in jobs.items():
    im = Image.open(src).convert("RGB")
    if box: im = im.crop(box)
    out = "img/%s.jpg" % name
    im.save(out, quality=80, optimize=True, progressive=True)
    total += os.path.getsize(out)
    print(name, im.size)
print(len(jobs), "images,", round(total / 1e6, 1), "Mo")
