Refactoring PyImage to make use of numpy arrays.