j2c extension support

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

j2c extension support

Post by jstph »

Magick, Is it possible to add the j2c extension into IM? It basically is j2k. right now, I checked the j2c extension myself, then set ImageInfo->magick to be "J2K". It worked, but if you can add it in IM that will be great.
Example file can be found at: https://github.com/bitsgalore/jp2kMagic ... alloon.j2c.
many many thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: j2c extension support

Post by magick »

It failed for us:
  • cp balloon.j2c balloon.j2k
    convert balloon.j2k balloon.png
    convert: Expected a SOC marker
    `OpenJP2' @ error/jp2.c/JP2ErrorHandler/226.
    convert: unable to decode image file `balloon.j2k' @ error/jp2.c/ReadJP2Image/374.
It looks like the OpenJPEG does not support the J2C variation of the JPEG-2000 format. If you prove otherwise (with ImageMagick 6.8.8-4), we will revisit the problem.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: j2c extension support

Post by Jason S »

Maybe you got a bad copy of the balloon.j2c file? It should start with 0xff 0x4f, which is an SOC marker.

.j2k, .j2c, and .jpc are all exactly the same format, and it is supported by OpenJPEG.
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Re: j2c extension support

Post by jstph »

Same as Jason. I have no problem to process that file with IM 6.8.8, and SOC mark is there.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: j2c extension support

Post by magick »

Are you using OpenJPEG 2 or Jasper? We recently migrated from Jasper to OpenJPEG 2. We're having problems with the JPC image with OpenJPEG 2.
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Re: j2c extension support

Post by jstph »

I use IM directly to process. I did step by step debug yesterday, and pretty sure it called j2k decoder from openjpeg. Originally I have problem with J2K file. After hours debug, I finally found out that my j2k file actually is the jp2, which has box header. IM only check file extension or ImageInfo->magick to choose decoder. As I know, there are lots of J2K and J2C files actually is jp2 with that 0x0000, 0x00FF and jp box header. Same thing happens to jpc, which actually is j2k or j2c file, and named as jpc. I wonder if that is your case.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: j2c extension support

Post by magick »

Dirk added a patch to fix the problem you reported. It will be available in ImageMagick 6.8.8-7 Beta, available by sometime tomorrow.
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Re: j2c extension support

Post by jstph »

thank you. look forward to update to the new version.
Post Reply