Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Latest commit

 

History

History
72 lines (53 loc) · 2.06 KB

README.md

File metadata and controls

72 lines (53 loc) · 2.06 KB

PyOpenJPEG

Deprecation Notice

This code is no longer being actively developed. For a more fully functional and active effort to create a Python interface to OpenJPEG, check out the Glymur project.

Overview

PyOpenJPEG is a Python wrapper around the OpenJPEG JPEG 2000 image library written using Cython.

Installation

NOTE: This library is currently in the early stages of development and is not yet ready for use.

First, install OpenJPEG 2.0 using either the provided binaries, or by compiling from source.

To install PyOpenJPEG, run:

python setup.py build_ext -i
python setup.py install

Usage

Here is a quick example of decoding an image:

>>> import openjpeg
>>> decoder = openjpeg.Decoder()
>>> img = decoder.decode(openjpeg.IMAGE_EIT)

Development

When contributing to PyOpenJPEG, it is recommended that you install the latest version of OpenJPEG from SVN.

Below are instructions for downloading and building the latest branch on Linux:

svn checkout http://openjpeg.googlecode.com/svn/trunk/ openjpeg
cd openjpeg
cmake build
make
sudo make install

There is currently an issue with OpenJPEG install which prevents some necessary includes being placed in the proper location. On Linux, you can you fix this by doing: ::

sudo su -
for file in /usr/local/include/openjpeg-1.99/*.h; do ln -s ${file} /usr/local/include/; done

The above command will create symbolic links in /usr/local/include to several needed header files.

To compile the PyOpenJPEG Cython code, run:

python setup.py build_ext -i

TODO

  1. Add support for saving to some common formats (BMP, PNG, etc)
  2. Add encoding support
  3. Automatically detect bit-depth of images during decoding