Page 1 of 1

Problem with jp2 file

Posted: 2009-04-17T13:57:50-07:00
by protargol
I have a jp2 file and I'm trying to get it to display using imagemagick. I've installed "jasper" but I'm not sure why it's not working. I'm running Ubuntu 8.04

For example:

Code: Select all

identify 300dpi.jp2 
results in

Code: Select all

error: cannot decode code stream
identify: unable to decode image file `300dpi.jp2'.
Is there something obvious I'm missing? Thanks.

Re: Problem with jp2 file

Posted: 2009-04-22T08:01:31-07:00
by protargol
bump

Re: Problem with jp2 file

Posted: 2009-04-22T10:35:20-07:00
by fmw42
It does not look like IM is recognizing your jp2 format. Did you recompile IM after installing jasper?
To check what delegates IM recognizes on your system, type

convert -list configure

Then look at the line starting with DELEGATES. Mine shows

DELEGATES bzlib fontconfig freetype gs jpeg jp2 lcms lqr openexr png tiff x11 xml zlib

Re: Problem with jp2 file

Posted: 2009-04-22T12:48:43-07:00
by protargol
I have re-installed IM after installing jasper and it still doesn't work. Here is my output to

Code: Select all

convert -list configure
DELEGATES bzlib djvu fontconfig freetype gvc jpeg jp2 lcms openexr png rsvg tiff wmf x11 xml zlib

Re: Problem with jp2 file

Posted: 2009-04-22T13:11:11-07:00
by fmw42
Best that I can recommend at this point is to post an example image and I will try on my system. Beyond that, you need more expert help from the IM folks. Perhaps it is not truly a jp2 file or is corrupt in some way.

Re: Problem with jp2 file

Posted: 2009-04-22T16:26:56-07:00
by protargol
Yeah, the file can be found here:

http://www.lpi.usra.edu/resources/mars_ ... 300dpi.jp2

I'm not sure what the catch is. Oh well.

Re: Problem with jp2 file

Posted: 2009-04-22T17:20:10-07:00
by fmw42
Your file is very large at 14 Mbytes and if decompresssed from jp2 will be even larger.

I tried identify 300dpi.jp2 but after waiting for many minutes with no reply nor any error, I gave up and cancelled out.

I was able to open the file on my Mac using QT Preview, but had to wait minutes. I did a screen snap of the displayed image. This is what it looks like.

Image

I suspect that it is so big that I am giving up waiting for IM to process it. But I don't get any errors, unless I am not waiting long enough.

Re: Problem with jp2 file

Posted: 2009-04-23T08:02:08-07:00
by protargol
No, it definitely died quickly for me. I'm not sure what the problem is. Thanks for the help though

Re: Problem with jp2 file

Posted: 2009-04-23T11:02:33-07:00
by magick
Identify returns these results for us:

Code: Select all

-> identify -verbose 300dpi.jp2 
ICC Profile CS 52474220
Image: 300dpi.jp2
  Format: JP2 (JPEG-2000 File Format Syntax)
  Class: DirectClass
  Geometry: 14393x11536+0+0
  Resolution: 72x72
  Print size: 199.903x160.222
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    red:
      min: 0 (0)
      max: 255 (1)
      mean: 197.534 (0.774642)
      standard deviation: 70.9981 (0.278424)
      kurtosis: -0.536426
      skewness: -0.896732
    green:
      min: 0 (0)
      max: 255 (1)
      mean: 182.418 (0.715364)
      standard deviation: 81.4284 (0.319327)
      kurtosis: -1.25766
      skewness: -0.519834
    blue:
      min: 0 (0)
      max: 255 (1)
      mean: 155.802 (0.610988)
      standard deviation: 110.529 (0.433446)
      kurtosis: -1.67985
      skewness: -0.380458
  Image statistics:
    OverAll:
      min: 0 (0)
      max: 255 (1)
      mean: 133.938 (0.525248)
      standard deviation: 110.34 (0.432707)
      kurtosis: -1.73504
      skewness: -0.0761453
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 14393x11536+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG2000
  Orientation: Undefined
  Properties:
    create-date: 2009-04-23T13:44:44-04:00
    modify-date: 2005-05-19T15:14:17-04:00
    signature: 68f94fa4905c2a08f3b4d6ef836570d3c96451ca02222aa3d3e1c6ff91fa8557
  Profiles:
    Profile-icc: 502 bytes
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 14mb
  Number pixels: 158.3mb
  Pixels per second: 2.004mb
  User time: 59.400u
  Elapsed time: 1:20
  Version: ImageMagick 6.5.1-6 2009-04-23 Q16 OpenMP http://www.imagemagick.org

Re: Problem with jp2 file

Posted: 2009-11-04T17:16:31-07:00
by oaksterdam
protargol:
I've been struggling with the same problem, same result. Ubuntu 8.04 lts, jasper, etc. I used to be able to use IM to manipulate JP2s, but am not sure what changed when to make it so that I couldn't. I haven't found anything online - other than this thread - dealing with the issue.

I know the mods aren't responsible for troubleshooting every installation & OS, but the last post isn't very helpful. I've got other tools that do similar things to identify (jhove, etc.), but here is my identify output:

identify centralsantaynez00dibbrich_0127.jp2
error: cannot decode code stream
identify: unable to decode image file `centralsantaynez00dibbrich_0127.jp2'.

The file in question above is 32k, so it isn't a size issue. Hope someone else has input.

Re: Problem with jp2 file

Posted: 2009-11-04T18:50:26-07:00
by magick
Post a URL to your image. We'll download it and see if we can reproduce the problem.

Re: Problem with jp2 file

Posted: 2009-11-16T16:11:31-07:00
by oaksterdam
here's a URL but I'm certain that there are no issues with based on other tools: cuyahoga.cdlib.org/centralsantaynez00dibbrich_0127.jp2

the issue has something to do with the installation on ubuntu. maybe specifically 8.04.
here is my convert -list configure output for DELEGATES:
DELEGATES bzlib djvu fontconfig freetype gvc jpeg jp2 lcms openexr png rsvg tiff wmf x11 xml zlib

you can see that jp2 is listed. i know you are trying to be certain that the image isn't the problem, but everything that protargol & i have been struggling with seems to be a config issue.

Re: Problem with jp2 file

Posted: 2009-12-13T17:49:08-07:00
by mheist
I was having similar problems with certain jp2 failing during convert, would get "error: cannot decode code stream". I think this is a problem with the Ubuntu 8.04 jasper distribution, I built jasper from source (same version as what ubuntu has) and could get things to work. Smaller j2ps always worked.

Running ubuntu jasper executable gets same results as convert, fails instantly on larger files:

bash:$ convert JXi0_27.jp2 test.jpg

error: cannot decode code stream

bash:$ jasper --input JXi0_27.jp2 --output test.jpg

error: cannot decode code stream


manual build of jasper works:

bash:$ ../apps/jasper-1.900.1/src/appl/jasper --input JXi0_27.jp2 --output test.jpg

(created test.jpg with no problem)


convert finally worked but only if I rebuilt ImageMagick after installing my build of jasper, I am a little confused why though.

bash:$ convert JXi0_27.jp2 test.jpg

(created test.jpg with no problem)

I also tried 300dpi.jp2 from above and it ran for long long time before failing with an error, I think now just because its so big (ubuntu version would return instantly with error)

bash:$ convert 300dpi.jp2 test.jpg
jpc_dec_decodecblks failed
error: cannot decode code stream



this is what I did

1) ubuntu ImageMagick, ubuntu jasper, both convert and jasper don't work on certain jp2
2) manual build of ImageMagick against ubuntu jasper, convert doesn't work
3) manual build of jasper works, convert doesn't
4) manual build of ImageMagick after installing manual jasper, convert works

So not really sure what happened, jasper is same version as what ubuntu has. Is it something with static v/s dynamic linking?

did manual builds with
ImageMagick-6.5.8-5
jasper-1.900.1