How to enable JPEG2000 (jp2) in ImageMagick?

Install libopenjp2-tools and use opj_decompress to convert jp2 to something else:

sudo apt install libopenjp2-tools
opj_decompress -i m_3712213_sw_10_h_20160625_20161004.jp2 -OutFor TIF -o my.tif

This package provides with command-line tools allowing for conversions between several formats and also provides tools for encoding and decoding motion-jpeg2000 video formats:

  • opj_decompress: decodes j2k, jp2, and jpt files to pgm, ppm, pnm, pgx, and bmp.
  • opj_compress: encodes pnm, pgm, pgx, bmp, and ppm files to j2k, and jp2.
  • opj_dump: dump information contains in j2k and jp2.
  • index_create: create jp2 with JPIP index file from a j2k file.
  • frames_to_mj2: convert YUV video streams to mj2 format.
  • mj2_to_frames: convert mj2 video streams to YUV format.
  • wrap_j2k_in_mj2: wrap j2k codestreams into mj2 format.
  • extract-j2k-from_mj2: extract j2k codestreams from the mj2 format.

I resolve my problem of enabling the openjp2 delegation in Imagemagick.

Be sure you have install :

  • openjp2 >= 2.1 (2.2 is the last available version, see https://github.com/uclouvain/openjpeg)
  • pkg-config (that's my problem)

Now when you launch ./configure you can see openjp2 delegation

DELEGATES = mpeg jbig jng jpeg lcms lzma openjp2 png tiff zlib


@arokath Like you, I was unable to find jp2 support in the version of ImageMagick that I installed through apt-get (Ubuntu 16.04.1 LTS).

Before building from source (following the ImageMagick docs), I installed first libopenjp2-tools and then libopenjp2-7-dev.

Note: I'm not sure which one did the trick: the alphabetical summary at the end of configure listed jp2 support as OpenJP2, rather than JP2 which I didn't notice until I had installed libopenjp2-7-dev and re-configured; it's quite possible it worked with only the first lib.

Besides ./configure, make and make install, I found that I needed (as suggested in the docs) to "configure the dynamic linker": sudo ldconfig /usr/local/lib.

Now, output of /usr/local/bin/identify -list format contains:

  J2C* rw-   JPEG-2000 Code Stream Syntax (2.1.0)
  J2K* rw-   JPEG-2000 Code Stream Syntax (2.1.0)
  JNX* r--   Garmin tile format
  JP2* rw-   JPEG-2000 File Format Syntax (2.1.0)
  JPC* rw-   JPEG-2000 Code Stream Syntax (2.1.0)
  JPM* rw-   JPEG-2000 File Format Syntax (2.1.0)
  JPT* rw-   JPEG-2000 File Format Syntax (2.1.0)
 JSON  -w+   The image format and characteristics