New file: imagetools.py