Sorry I gave the wrong line number. The line is 2161. It code looks like
this:
if ((image->numcomps == 1 || image->numcomps == 3) && (jp2->bpc != 255)) {
jp2->meth = 1; /* METH: Enumerated colourspace */
} else {
jp2->meth = 2; /* METH: Restricted ICC profile */
}
if (jp2->meth == 1) {
if (image->color_space == 1)
jp2->enumcs = 16; /* sRGB as defined by IEC 61966–2–1 */
else if (image->color_space == 2)
jp2->enumcs = 17; /* greyscale */
else if (image->color_space == 3)
jp2->enumcs = 18; /* YUV */
} else {
jp2->enumcs = 0; /* PROFILE (??) */
}
Anyway, when numComps is greater than 3 jp2->meth gets set to 2. Later in
the code the Meth 2 should write an ICC Profile, but it writes out a 0
instead. I think it is best to not set meth 2 unless a real ICC profile is
going to actually be written. I don't now the actual requirement about 4
band imagery, but the ECW and Photoshop JP2 readers do not seem to care if
the ICC profile is there.
On Friday, November 16, 2012 8:48:26 PM UTC-6, szuk
...@arcor.de wrote:
> I downloaded the latest OpenJPEG v2 revision 2223 and did not find 'meth'
> in the lines
> given.
> winfried
> ----- Original Nachricht ----
> Von: Will K <willk...@gmail.com <javascript:>>
> An: open...@googlegroups.com <javascript:>
> Datum: 15.11.2012 16:25
> Betreff: [OpenJPEG] Writing JP2 openjpegv2, Colour specification box, ICC
> profile issue with greater than 3 bands
> > I downloaded the latest OpenJpeg v2 source. I am writing JP2 images
> with
> > greater than 3 bands. In jp2.c line 1427 the meth is set to 2 for bands
> > greater than 3. This requires an ICC profiles to be written. The
> library
> > just sets it to NULL in line 722. If I write JP2 this way, other JP2
> > readers get upset. The ECW SDK reader errors and crashes and Photoshop
> > display a ICC profile error but does recover and open the file. I took
> a
> > quick look at the ICC profile specs and I didn't see anything about
> higher
> > bands covered. My current solution is to just change jp2.c to set the
> meth
> > to 1 and the color space to RGBs for bands greater than 3. When I write
> > this way the ECW SDK opens it fine and so does Photoshop. Is there any
> > problem with this solution?