Use io.BytesIO instead of StringIO.StringIO in test_image.py