Version that works with Pillow