I am about to run a simulation in which I need to encode and decode image files with JPEG2000. I need an API that gives me the flexibility to set coding rate (or quality of the compressed file). Is there any API for Python to do so?


Since version 2.4.0 Pillow supports most JPEG 2000 files as explained here - the exception being files with mixed sampling rates.

Pillow is:

  • a maintained fork of PIL
  • pip installable with pip install Pillow
  • gives you a huge range of image manipulation options & file type support
  • currently at version 5.2.0 so it has supported JPEG 2000 for a long time
  • pretty much the standard library for image manipulation
| improve this answer | |

I can't vouch for it personally, but a quick Google search yielded Glymur which looks to be exactly what you are asking for. From the into page:

Glymur is an interface to the OpenJPEG library which allows one to read and write JPEG 2000 files from Python. Glymur supports both reading and writing of JPEG 2000 images, but writing JPEG 2000 images is currently limited to images that can fit in memory. Glymur can read images using OpenJPEG library versions as far back as 1.3, but it is strongly recommended to use at least version 2.1.2.

| improve this answer | |
  • Thank you for your suggestion. I was aware of this package, but it does not offer the parameter control I need due to the best of my knowledge. – Milad Aug 8 '18 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.