#!/usr/bin/env python3 """Compare fixture color palettes, not mismatched animation frames.""" import hashlib import json from pathlib import Path from PIL import Image root=Path(__file__).resolve().parent result={'evidence_class':'offline analysis of native board captures', 'limit':'Different animation frames; this is a region-palette comparison, not full pixel equivalence.', 'captures':{},'differences':{}} for mode in ('gpu','pixman'): result['captures'][mode]={} for name in ('scene-first','scene-later'): path=root/mode/(name+'.png') with Image.open(path) as source: im=source.convert('RGB') assert im.size==(568,1232) def palette(box): colors=im.crop(box).getcolors(568*1232) assert colors is not None return sorted([list(color) for _,color in colors],key=sum) parent=sum(1<