Image Processing In Python Using Global Variables