import json,sys
from PIL import Image
d=json.load(open('/tmp/evidence-21165/manifest.json'))
for e in d['diffs']:
    n=e['after'][6:-4]
    if n not in sys.argv[1:]: continue
    x0,y0,x1,y1=e['changedBounds']; y1=min(y1,y0+260)
    b=Image.open('/tmp/evidence-21165/'+e['before']).crop((x0-8,y0-70,x1+8,y0+120))
    a=Image.open('/tmp/evidence-21165/'+e['after']).crop((x0-8,y0-70,x1+8,y0+120))
    w,h=b.size; o=Image.new('RGB',(w*2+10,h),'red'); o.paste(b,(0,0)); o.paste(a,(w+10,0))
    o=o.resize((o.width*2,o.height*2),Image.NEAREST); o.save(f'/tmp/rev2-21165/{n}.png'); print(n,e['changedBounds'],e['outsideExpectedCardPixels'])
