seemoo-lab / opendrop

An open Apple AirDrop implementation written in Python
https://owlink.org
GNU General Public License v3.0
8.49k stars 265 forks source link

Encoder jpeg2k not available #41

Closed CaptainStabs closed 3 years ago

CaptainStabs commented 4 years ago

Installed opendrop using pip installation method.

<Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/PIL/ImageFile.py", line 498, in _save
    fh = fp.fileno()
io.UnsupportedOperation: fileno

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 476, in _getencoder
    encoder = getattr(core, encoder_name + "_encoder")
AttributeError: module 'PIL._imaging' has no attribute 'jpeg2k_encoder'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/opendrop", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/opendrop/cli.py", line
36, in main
    AirDropCli(sys.argv[1:])
  File "/usr/local/lib/python3.7/dist-packages/opendrop/cli.py", line
87, in __init__
    self.send()
  File "/usr/local/lib/python3.7/dist-packages/opendrop/cli.py", line
166, in send
    if not self.client.send_ask(self.file):
  File "/usr/local/lib/python3.7/dist-packages/opendrop/client.py",
line 151, in send_ask
    icon = AirDropUtil.generate_file_icon(f.name)
  File "/usr/local/lib/python3.7/dist-packages/opendrop/util.py", line
175, in generate_file_icon
    im.save(imgByteArr, format='JPEG2000')
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2084, in save
    save_handler(self, fp, filename)
  File "/usr/lib/python3/dist-packages/PIL/Jpeg2KImagePlugin.py", line
294, in _save
    ImageFile._save(im, fp, [("jpeg2k", (0, 0) + im.size, 0, kind)])
  File "/usr/lib/python3/dist-packages/PIL/ImageFile.py", line 503, in _save
    e = Image._getencoder(im.mode, e, a, im.encoderconfig)
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 479, in _getencoder
    raise IOError("encoder %s not available" % encoder_name)
OSError: encoder jpeg2k not available

I've tried everything that I could think of to install jpeg2k (too many things to list, mostly making sure that all of the openjpeg stuff was installed)

schmittner commented 4 years ago

What‘s your platform? OS version? PIL version?

CaptainStabs commented 4 years ago

Kali Linux, i386 2019.4, the python3 PIL version is 6.2.1, and the python2.7 PIL version is 5.4.1

schmittner commented 4 years ago

Hm, this definitely seems to be a problem of your PIL version. Maybe this helps:

To enable JPEG 2000 support, you need to build and install the OpenJPEG library, version 2.0.0 or higher, before building the Python Imaging Library.

schmittner commented 3 years ago

Closing this as stale.