IM thinks the "frm_1883.j2c" image is in linear colorspace RGB, though it is really XYZ in this case.
I am not certain if that is a 'correct' assumption or not, as my understanding is that IM should think of a image without a profile as being sRGB.
The image also contains a color ICC profile "IEC 61966-2.1 Default RGB colour space - sRGB"
which is obviously WRONG, and means you can not use profiles to do the color conversion (the best way).
Setting the right colorspace at the end of what you had works. (leaving the profile, on the assumption it will then be correct)
Code: Select all
convert frm_1883.j2c \
-alpha Off -gamma 0.384615 \
-color-matrix "3.2404542 -1.5371385 -0.4985314 \
-0.9692660 1.8760108 0.0415560 \
0.0556434 -0.2040259 1.0572252" \
-gamma 2.2 \
-set colorspace sRGB \
-depth 8 \
t1.tif
gives exactly the same as the example TIF output you provided "frm_1883.tif"
Doing a correct RGB -> sRGB conversion is very slightly different, especially in the darker colors. (with the -strip this time)
Code: Select all
convert frm_1883.j2c \
-strip -alpha Off -gamma 0.384615 \
-color-matrix "3.2404542 -1.5371385 -0.4985314 \
-0.9692660 1.8760108 0.0415560 \
0.0556434 -0.2040259 1.0572252" \
-set colorspace RGB -colorspace sRGB \
-depth 8 \
t2.tif
However it looks like XYZ conversion built into IM is NOT the same as the above color matrix for XYZ to RGB conversion.
Code: Select all
convert frm_1883.j2c \
-strip -alpha Off -gamma 0.384615 \
-set colorspace XYZ -colorspace sRGB \
t3.tif
Either your matrix is not XYZ conversion, or IM XYZ is not right. I think it may be IM as it looks too dark, and doing a extra conversion to correct works.
Code: Select all
convert frm_1883.j2c \
-strip -alpha Off -gamma 0.384615 \
-set colorspace XYZ -colorspace sRGB \
-set colorspace RGB -colorspace sRGB \
t4.tif
NOTE: The test of sRGB->XYZ->sRGB round trip does come out correct, but that only means it is symmetric... It does not mean the XYZ conversion is correct! -- reporting.
Hopefully the XYZ conversions will be fixed soon.