clean up d_a.py using PIL to read the image