from pathlib import Path
from PIL import Image,ImageChops
import json
root=Path('/tmp/lead-29548-r1/evidence-capture-2')
rows=[]
for p in sorted(root.glob('*-a.png')):
 b=p.with_name(p.name.replace('-a.png','.png'))
 if not b.exists():continue
 a=Image.open(p).convert('RGB');d=ImageChops.difference(a,Image.open(b).convert('RGB'))
 n=sum(any(v) for v in d.getdata());rows.append({'frame':b.name,'Diff0':n,'size':a.size,'intervalMsAtLeast':500});assert n==0,b.name
(root/'stability-checks.json').write_text(json.dumps(rows,indent=2));print(len(rows),'accepted stills, all Diff0=0')
