ImageMagick is missing JPEG2000 support (needs to be built with openjpeg)

Bug #1447968 reported by Stanislav Bocinec
134
This bug affects 27 people
Affects Status Importance Assigned to Milestone
imagemagick (Debian)
Fix Released
Unknown
imagemagick (Ubuntu)
Fix Released
Medium
Brian Murray

Bug Description

ImageMagick had been always built with JPEG2000 support ("JPEG-2000 --with-jp2=yes yes"). Since Vivid Vervet's 8:6.8.9.9-5 version it's not more built with jp2 support thus it lost the support to work with JPEG2000 images ("JPEG-2000 --with-jp2=").

This is pretty annoying, as JPEG 2000 is pretty popular lossless format.

$ identify -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-01-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

$ identify pic.jp2
identify: no decode delegate for this image format `JP2' @ error/constitute.c/ReadImage/501.

$ file pic.jp2
pic.jp2: JPEG 2000 Part 1 (JP2)

$ convert pic.jp2 pic.png
convert: no decode delegate for this image format `JP2' @ error/constitute.c/ReadImage/501.
convert: no images defined `pic.png' @ error/convert.c/ConvertImageCommand/3210.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid

$ uname -a
Linux ubo1504 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ dpkg -l |grep imagemagick
ii imagemagick 8:6.8.9.9-5 amd64 image manipulation programs -- binaries
ii imagemagick-6.q16 8:6.8.9.9-5 amd64 image manipulation programs -- quantum depth Q16
ii imagemagick-common 8:6.8.9.9-5 all image manipulation programs -- infrastructure

Thanks for fixing this.

tags: added: vivid
description: updated
Changed in imagemagick (Ubuntu):
status: New → Confirmed
Changed in imagemagick (Ubuntu):
importance: Undecided → Critical
importance: Critical → High
Changed in imagemagick (Debian):
status: Unknown → Fix Committed
Changed in imagemagick (Debian):
status: Fix Committed → Fix Released
Mathew Hodson (mhodson)
tags: added: regression-release
Changed in imagemagick (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
rew (r-e-wolff) wrote :

Also affects XENIAL.

I tried compiling from source: Resulting binary: no JP2 support.

Then I installed "libopenjp2-dev" and built again. Now I do have jp2 support.

So the problem is that the imagmagick upstream releas has switched to prefer libopenjp2 instead of libjasper, while the ubuntu build procedure lists libjasper-dev as a build requirement instead of libopenjp2.

Mathew Hodson (mhodson)
Changed in imagemagick (Ubuntu):
importance: High → Medium
Mathew Hodson (mhodson)
tags: added: packaging
Mathew Hodson (mhodson)
tags: added: xenial
Revision history for this message
Cory Albrecht (bytor) wrote :

Add me to the list for whom this is annoying. ImageMagick switch from libjasper to libopenjp2 two years ago, and the Debian upstream packages was fixed a year ago, so why is this not fixed on Ubuntu yet?

Revision history for this message
Mathew Hodson (mhodson) wrote :

The reason this has not been fixed is because imagemagick is in main, so all of its build-deps must be in main. openjpeg2 is not in main so that needs to get put in main first.

There is a main inclusion request in bug 711061, so hopefully we can see this fixed in the future.

summary: - ImageMagick lost JPEG2000 support in Vivid Vervet
+ ImageMagick is missing JPEG2000 support (needs to be built with
+ openjpeg)
Revision history for this message
Sam Wilson (samwilson.id.au) wrote :

Is there a workaround that will get JP2 support working?

tags: added: bionic
tags: added: cosmic
Revision history for this message
Earle Lyons (earlev4) wrote :

Hi. Are there any updates to ImageMagick JP2 support? Thanks!

Revision history for this message
Stefan Horning (stefan-horning) wrote :

Looks like bug #711061 is still blocking it

Revision history for this message
Irfan Rahman (irfan.rahman) wrote :

2019-06-27: just tired to install "imagemagick" on a fresh 18.04.2 LTS, still no JP2 support.

Revision history for this message
Sergio Callegari (callegar) wrote :

Any particular reason why imagemagick needs to stay in main, given that this seems to hinder the capabilities of this package by not letting it link against openjpeg2? That is: rather than waiting for openjpeg2 to be included in main, cannot imagemagick be taken out of main?

Alternatively, can a more capable imagemagick be made available out of main with proper conflict to the imagemagick in main?

Revision history for this message
Mathew Hodson (mhodson) wrote :

openjpeg2 was promoted to main in bug #711061, so this could be enabled now like it was in Debian.

Revision history for this message
Kirill (chickencombo) wrote :

Could we please get some action on this now that it has been promoted? :)

Changed in imagemagick (Ubuntu):
assignee: nobody → Brian Murray (brian-murray)
status: Triaged → In Progress
Revision history for this message
Gwyneth Llewelyn (gwyneth-llewelyn) wrote :

Ok, I came across this open thread thinking that it was abandoned (it's from 2015!), but apparently there have been a few messages in the past few days, so at least I know I'm not insane... as the OP said, I was assuming that IM on Ubuntu (even on my old 16.04.6 LTS Xenial) came with the JP2 coder built-in, and, indeed, I *thought* that this was the case:

# convert -list coder | grep JP2
J2C JP2
J2K JP2
JPC JP2
JPM JP2
JPT JP2
JPX JP2
PGX JP2

But clearly this is *not* true, since on ImageMagick 6.8.9-9 Q16 x86_64 built in 2019-11-12 I get:

Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

(well, I have added a lot of stuff, thus Cairo etc. are listed)

I also have installed *both* jasper (lib and runtime) as well as libopenjp2-7 (and libopenjpeg-dev & libjpeg62-dev & openjpeg-tools for good measure...).

I'm not really familiar with IM — I thought, for instance, that you could just tweak the .xml files and get 'instant' results without needing to recompile it — so I guess that my only choice is to install IM from the sources to get JPEG-2000 support?... I have little faith that, after 5 years, there are still developers with free time and willingness to 'fix' this bug, especially because I can very well imagine that the latest Ubuntu versions have fixed this somehow...

There *is* a PPA listing imagemagick-jp2 which *does* have working JPEG-2000 support, but they haven't applied the latest security patches...

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package imagemagick - 8:6.9.10.23+dfsg-2.1ubuntu12

---------------
imagemagick (8:6.9.10.23+dfsg-2.1ubuntu12) groovy; urgency=medium

  * Build depend on libopenjp2-7-dev as that is in main. (LP: #1447968)

 -- Brian Murray <email address hidden> Fri, 22 May 2020 15:43:14 -0700

Changed in imagemagick (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Gwyneth Llewelyn (gwyneth-llewelyn) wrote :

Aw. No fix for focal?... Anyway, I hope that groovy bumps ImageMagick to 7 like all other Linux distributions out there (as well as macOS via Homebrew and FreeBSD). After all, IM 7 has been around since April 2016, it's very mature code these days, after 227 releases (as of the date of writing), and it seems sort of strange why it has not been supported under Ubuntu...

Revision history for this message
Eric Mitchell (eamitchell1) wrote :

It is April 2024 and I am having trouble getting ImageMagick to convert JP2 files. Has this problem really been fixed or is just broken again? I don't see jp2 or J2K listed in the delegates.

 PHP Fatal error: Uncaught ImagickException: no decode delegate for this image format `J2K' @ error/constitute.c/ReadImage/572 in /home/eric/convert-test.php:7
Stack trace:
#0 /home/eric/convert-test.php(7): Imagick->readimage()
#1 {main}
  thrown in /home/eric/convert-test.php on line 7

Current versions are:
ImageMagick 7.1.1-31 (Beta) Q16-HDRI x86_64 dd459b01f:20240407 https://imagemagick.org
    Features: Cipher DPC HDRI Modules OpenMP(4.5)
    Delegates (built-in): jbig jpeg ltdl lzma tiff x xml zlib
    Compiler: gcc (9.4)
PHP 7.4.3-4ubuntu2.20 (cli) (built: Feb 21 2024 13:54:34) ( NTS )
Ubuntu 20.04.6 LTS Release: 20.04

Revision history for this message
Gwyneth Llewelyn (gwyneth-llewelyn) wrote :

All I can say is that on Ubuntu 22.04.4 LTS (jammy) I (still) don't get IM 7 yet — most likely because it's not due for release in a LTS distro? — and I'm still stuck with 6.9.11.60.

Since for a few package I *need* IM 7 (namely, PHP from Ondrej's repository (https://ppa.launchpadcontent.net/ondrej/php/ubuntu/), I have compiled it from scratch (what else could I do?...).

Naturally enough, JPEG2000 support — which I desperately need as well! — works flawlessly:

$ magick --version
Version: ImageMagick 7.1.1-31 (Beta) Q16-HDRI x86_64 dd459b01f:20240407 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib cairo fontconfig freetype gslib heic jbig jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raqm raw webp x xml zip zlib zstd
Compiler: gcc (11.4)

@eamitchell, your version actually seems very weird to me — not even PNG support??

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Eric, this issue was fixed after Ubuntu 20.04 LTS "focal". I encourage you to upgrade to Ubuntu 22.04 LTS.

In general, it is better to open new issues than comment on issues that are marked Fix Released because people may not see your comments.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.