Page 1 of 1

jp2: 'cannot decode code stream'

Posted: 2013-05-23T11:57:08-07:00
by hinote
Hi there,

I found a couple of jp2 images that cannot be opened in ImageMagick Display and cannot be converted with convert:

Code: Select all

C:\Temp>convert -version
Version: ImageMagick 6.8.5-7 2013-05-19 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma png ps tiff x xml zlib

C:\Temp>convert 01003557568_0060.jp2 01003557568_0060.png
error: cannot decode code stream
convert.exe: unable to decode image file `01003557568_0060.jp2' @ error/jp2.c/ReadJP2Image/404.
convert.exe: no images defined `01003557568_0060.png' @ error/convert.c/ConvertImageCommand/3106.

C:\Temp>convert 01003557568_0149.jp2 01003557568_0149.png
error: cannot decode code stream
convert.exe: unable to decode image file `01003557568_0149.jp2' @ error/jp2.c/ReadJP2Image/404.
convert.exe: no images defined `01003557568_0149.png' @ error/convert.c/ConvertImageCommand/3106.
Both samples are on archive.org, see
https://ia601707.us.archive.org/2/items ... 68_jp2.zip
Other pages in this archive are opened and converted with no problems.

Thanks for your work!

Re: jp2: 'cannot decode code stream'

Posted: 2013-05-23T14:16:42-07:00
by fmw42
Works fine for me

convert 01003557568_0060.jp2 01003557568_0060.png


convert -version
Version: ImageMagick 6.8.5-7 2013-05-19 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib mpeg fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr lzma openexr png ps tiff x xml zlib


I am on Mac OSX Snow Leopard. The only difference I see is that my OpenMP is disabled.

What version of Jasper delegate library are you using. Mine is

jasper --version
1.900.1

Re: jp2: 'cannot decode code stream'

Posted: 2013-05-23T14:40:28-07:00
by hinote
The application is installed from ImageMagick-6.8.5-7-Q16-x86-dll.exe, as far as I remember...
Running on Windows 7 Pro SP1 64-bit.

Have no idea what the jasper delegate library can mean.
The jasper command is not available in my command line (unlike convert).

Re: jp2: 'cannot decode code stream'

Posted: 2013-05-23T14:49:41-07:00
by hinote
Read once again my previous post, found an inconsistence (I was running the x86 version on 64-bit Windows), reinstalled application using ImageMagick-6.8.5-7-Q16-x64-dll.exe - same (negative) result, still 'cannot decode code stream'...

Re: jp2: 'cannot decode code stream'

Posted: 2013-05-23T15:33:09-07:00
by fmw42
IM uses the Jasper delegate library to process JP2000 images. See http://www.imagemagick.org/download/delegates/ and http://www.ece.uvic.ca/~frodo/jasper/ and http://en.wikipedia.org/wiki/JasPer

The fact that your convert -version shows jp2 means that it found the delegate library. That is all that I can tell you. Either there is a problem with the IM Windows binary or the jasper delegate library is too old or corrupt.

I am not a Windows user, so cannot help much further on this. Perhaps another Windows user can test for you.

Note also that Jasper cannot handle all the JP2 formats. But since I was able to convert it, that should not be the issue.

Re: jp2: 'cannot decode code stream'

Posted: 2013-05-23T23:37:38-07:00
by snibgo
On Windows 7, the following ...

Code: Select all

convert 01003557568_0060.jp2 x.png
convert 01003557568_0149.jp2 y.png
... work for me with no problem.

Version: ImageMagick 6.8.5-0 2013-04-23 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma pango png ps tiff x xml zlib