Do not read layers immediately when opening PSD images by radarhere · Pull Request #8039 · python-pillow/Pillow
👍
main:
❯ python -m timeit -s "from PIL import Image" "Image.open('Tests/images/hopper.psd')" 2000 loops, best of 5: 166 usec per loop ❯ python -m timeit -s "from PIL import Image" "im = Image.open('Tests/images/hopper.psd'); im.layers" 2000 loops, best of 5: 164 usec per loop
PR:
❯ python -m timeit -s "from PIL import Image" "Image.open('Tests/images/hopper.psd')" 2000 loops, best of 5: 101 usec per loop ❯ python -m timeit -s "from PIL import Image" "im = Image.open('Tests/images/hopper.psd'); im.layers" 2000 loops, best of 5: 164 usec per loop
(These runs were actually the third ones, to make sure everything had imported properly and avoid delays after an initial build.)