jp2: 'cannot decode code stream'

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
hinote
Posts: 3
Joined: 2013-05-23T11:46:33-07:00
Authentication code: 6789

jp2: 'cannot decode code stream'

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: jp2: 'cannot decode code stream'

Post 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
hinote
Posts: 3
Joined: 2013-05-23T11:46:33-07:00
Authentication code: 6789

Re: jp2: 'cannot decode code stream'

Post 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).
hinote
Posts: 3
Joined: 2013-05-23T11:46:33-07:00
Authentication code: 6789

Re: jp2: 'cannot decode code stream'

Post 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'...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: jp2: 'cannot decode code stream'

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: jp2: 'cannot decode code stream'

Post 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
snibgo's IM pages: im.snibgo.com
Post Reply