{"id":23796,"library":"glymur","title":"glymur","description":"Python library for reading and writing JPEG 2000 files, wrapping the OpenJPEG library. Current version 0.14.7, requires Python >=3.11, release cadence irregular.","status":"active","version":"0.14.7","language":"python","source_language":"en","source_url":"https://github.com/quintusdias/glymur","tags":["JPEG2000","image","openjpeg","lossless"],"install":[{"cmd":"pip install glymur","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Array operations for image data","package":"numpy","optional":false},{"reason":"Version parsing utilities","package":"packaging","optional":false}],"imports":[{"note":"lowercase module name","wrong":"import Glymur","symbol":"glymur","correct":"import glymur"},{"note":"Jp2k is a class in the top-level module","wrong":"from glymur.Jp2k import Jp2k","symbol":"Jp2k","correct":"from glymur import Jp2k"}],"quickstart":{"code":"import glymur\n\n# Open a JPEG 2000 file\njp2 = glymur.Jp2k('input.jp2')\nprint('Shape:', jp2.shape)\nprint('Image data:', jp2[:])\n\n# Write a JPEG 2000 file\nimport numpy as np\ndata = np.random.randint(0, 256, (256, 256), dtype=np.uint8)\nglymur.Jp2k('output.jp2', data=data)  # or use jp2.write(data)","lang":"python","description":"Read and write JPEG 2000 images with glymur."},"warnings":[{"fix":"Upgrade Python to 3.11 or later.","message":"Version 0.14 dropped support for Python 3.9 and 3.10. Requires Python >=3.11.","severity":"breaking","affected_versions":"0.14+"},{"fix":"Replace jp2.codestream.crat with jp2.codestream.compression_ratios and jp2.codestream.cdef with jp2.codestream.color_space.","message":"In 0.14, the 'crat' and 'cdef' family of attributes were removed from Codestream. Use 'compression_ratios' and 'color_space' instead.","severity":"breaking","affected_versions":"0.14+"},{"fix":"Install OpenJPEG via system package manager or conda (e.g., conda install -c conda-forge openjpeg).","message":"glymur relies on OpenJPEG system library; missing or incompatible libopenjp2 can cause ImportError or silent failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use .copy() if you need a separate array.","message":"Jp2k object indexing returns a view, not a copy; modifying the slice modifies the underlying data in place.","severity":"gotcha","affected_versions":"all"},{"fix":"Use jp2[:] to read full image data.","message":"The glymur.Jp2k.read() method is deprecated in favor of direct indexing (jp2[:]) or waveform reading.","severity":"deprecated","affected_versions":"0.10+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install OpenJPEG: apt install libopenjp2-7-dev (Linux) or brew install openjpeg (macOS) or conda install openjpeg.","cause":"OpenJPEG library not installed or not in library path.","error":"ImportError: libopenjp2.so.7: cannot open shared object file"},{"fix":"Use direct indexing: data = jp2[:] instead of jp2.read().","cause":"Use of deprecated read() method removed in newer versions.","error":"AttributeError: 'Jp2k' object has no attribute 'read'"},{"fix":"Use jp2.codestream.compression_ratios instead of jp2.codestream.crat.","cause":"Breaking change in version 0.14 removing old attributes.","error":"ValueError: The 'crat' attribute is no longer available."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}