Pillow and JPEG2000: decoder jpeg2k not available

前端 未结 3 437
终归单人心
终归单人心 2020-12-18 10:40

I\'m trying to set up Flask-IIIF to work with jp2-files, or JPEG2000. Right out of the box I get an error from the Pillow library: IOError: decoder jpeg2k

相关标签:
3条回答
  • 2020-12-18 10:48

    for linux

    sudo yum install -y libjpeg-devel
    sudo pip uninstall pillow
    sudo pip install pillow
    

    for windows

    # download
    import imageio
    imageio.plugins.freeimage.download()
    
    # install
    pip uninstall pillow
    pip install pillow
    
    0 讨论(0)
  • 2020-12-18 10:51

    Pillow needs the OpenJPEG library to decode JPEG2000 files. libjpeg only deals with regular JPEGs.

    See the note in the Pillow docs at the end of this section: http://pillow.readthedocs.io/en/latest/handbook/image-file-formats.html#jpeg-2000

    0 讨论(0)
  • 2020-12-18 10:54

    Windows users: After you installed OpenJPEG and added its bin folder to PATH, you need to re-build the pillow library. Using Conda I didn't find a solution to do that so I ended up using the windows installer from PyPi as suggested in this answer here. The installer found my Anaconda installation and it seems it simply overwrote the pillow library there.

    0 讨论(0)
提交回复
热议问题