Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jpeg2000 encoding #618

Closed
totaam opened this issue Jul 26, 2014 · 8 comments
Closed

jpeg2000 encoding #618

totaam opened this issue Jul 26, 2014 · 8 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Jul 26, 2014

Issue migrated from trac ticket # 618

component: encodings | priority: minor | resolution: fixed

2014-07-26 14:38:29: totaam created the issue


I was curious to see how well or badly this would perform...

And it turns out that it isn't even stable enough to run the performance tests. That answers it.

@totaam
Copy link
Collaborator Author

totaam commented Jul 26, 2014

2014-07-26 14:38:53: totaam uploaded file jpeg2000.patch (6.9 KiB)

adds support for jpeg2000 via PIL

@totaam
Copy link
Collaborator Author

totaam commented Nov 26, 2017

2017-11-26 14:51:06: antoine uploaded file jpeg2000-v2.patch (5.2 KiB)

updated patch

@totaam
Copy link
Collaborator Author

totaam commented Nov 26, 2017

2017-11-26 15:53:37: antoine changed owner from antoine to maxmylyn

@totaam
Copy link
Collaborator Author

totaam commented Nov 26, 2017

2017-11-26 15:53:37: antoine commented


Turns out that it is supported in pillow: jpeg-2000.

The (totally not obvious) reason why we get this error with it:

(...)
packages/xpra/server/window/window_source.py", line 2008, in make_data_packet
    ret = encoder(coding, image, options)
  File "/usr/lib64/python2.7/site-packages/xpra/server/window/window_source.py", line 2120, in pillow_encode
    return self.enc_pillow.encode(coding, image, q, s, transparency)
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/pillow/encode.py", line 190, in encode
    im.save(buf, pil_fmt, **kwargs)
  File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1928, in save
    save_handler(self, fp, filename)
  File "/usr/lib64/python2.7/site-packages/PIL/Jpeg2KImagePlugin.py", line 264, in _save
    ImageFile._save(im, fp, [('jpeg2k', (0, 0)+im.size, 0, kind)])
  File "/usr/lib64/python2.7/site-packages/PIL/ImageFile.py", line 495, in _save
    raise IOError("encoder error %d when writing image file" % s)
IOError: encoder error -2 when writing image file

Is that there is an undocumented size constraints on images, which must be at least 32x32 in size.

So r17521 adds "jpeg2000" encoding but only uses as a last resort for now, and only when we know for sure that the image will be bigger than 32x32.
It does seem to compress quite well, and not too slowly either.

Since we handle encode and decode via pillow, we now also have a way to completely skip "jpeg2000" from the pillow test encode and decode that occurs during codec probing. This may be useful if we encounter crashes or incompatibilities, default values shown:

XPRA_PILLOW_DECODE_FORMATS="png,png/L,png/P,jpeg,webp,jpeg2000"
XPRA_PILLOW_ENCODE_FORMATS="png,png/L,png/P,jpeg,webp,jpeg2000"

@maxmylyn: just a FYI, feel free to close.

@totaam
Copy link
Collaborator Author

totaam commented Nov 29, 2017

2017-11-29 18:52:07: maxmylyn changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Nov 29, 2017

2017-11-29 18:52:07: maxmylyn set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Nov 29, 2017

2017-11-29 18:52:07: maxmylyn commented


Noted. Closing.

@totaam totaam closed this as completed Nov 29, 2017
@totaam
Copy link
Collaborator Author

totaam commented Apr 21, 2019

2019-04-21 08:56:43: antoine commented


Support removed in r22494, see #2279#comment:2.

This was referenced Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant