ImageMagick lossless JPEG2000 compression of 10-bit per component images is wrong

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
JoakimZiegler
Posts: 7
Joined: 2016-03-14T21:33:49-07:00
Authentication code: 1151

ImageMagick lossless JPEG2000 compression of 10-bit per component images is wrong

Post by JoakimZiegler »

Code: Select all

Version: ImageMagick 6.9.3-7 Q16 x86_64 2016-03-13 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib fontconfig freetype jp2 lcms pangocairo png tiff x xml zlib
See discussion here: https://imagemagick.org/discourse-serve ... 59#p131059

Basically, while JPEG2000 compression works as expected with 8-bit and 16-bit images, it fails for 10-bit images, the output image is not identical to the original. Confirmed by two different people. OpenJPEG's own compression utility does generate a lossless 10-bit JPEG2000 file that's identical to the original, so this is likely a bug in ImageMagick.
JoakimZiegler
Posts: 7
Joined: 2016-03-14T21:33:49-07:00
Authentication code: 1151

Re: ImageMagick lossless JPEG2000 compression of 10-bit per component images is wrong

Post by JoakimZiegler »

I did some additional testing. This also fails for 12-bit and 14-bit depth TIFF images to JPEG2000. (I'm basically using ImageMagick to do convert image-16b.tif -depth 12 image-12b.tif and so on, then compressing those output images to JPEG2000).

Additionally, using a 12-bit TIFF as input when converting to JPEG2000 gives the following warning message:

Code: Select all

convert: Deprecated fields cp_cinema or cp_rsiz are used
Please consider using only the rsiz field
See openjpeg.h documentation for more details
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/236.
Post Reply