A local image edit gives me two things to review: the requested change and everything that was meant to stay untouched. Looking only at the edited object makes the second part easy to miss.
I want a map of changes outside the allowed region. A binary mask makes that region explicit: white means editable; black means preserve.
Compare the preserved pixels
Install Pillow:
python -m pip install Pillow
Enter fullscreen mode
Exit fullscreen mode
Save this as image_audit.py :
import argparse import json from pathlib import Path from PIL import Image , ImageChops , ImageOps
def load ( path , mode ): with Image . open ( path ) as image : return ImageOps . exif_transpose ( image ). convert ( mode )
def audit ( before , after , mask , output , threshold = 8 ): if not 0 <= threshold <= 255 : raise ValueError ( " threshold must be between 0 and 255 " ) a , b = load ( before , " RGBA " ), load ( after , " RGBA " ) allowed = load ( mask , " L " ) if a . size != b . size or a . size != allowed .…