Page 1 of 1

Colour profiles & converting to JP2

Posted: 2019-02-10T23:59:07-07:00
by ozbigben
Hi All

I found an old post related to this(https://www.imagemagick.org/discourse-s ... hp?t=26210) but thought it might be better to start a new one. I'm looking for a method to save a JP2 with lossless compression and the AdobeRGB colour profile. A command line of:

Code: Select all

convert in.tif -quality 0 out.jp2
... results in a lossless JP2 with an sRGB profile set regardless of the colour profile of the source image. If, for example, this image is then opened in Photoshop the colours will display differently to the original. Assigning (NOT converting) the Adobe RGB profile to the image will display the colour correctly.

Inspecting the JP2 with EXIFTool provides.

Code: Select all

Jpeg2000:MajorBrand=JPEG 2000 Image (.JP2)
Jpeg2000:MinorVersion=0.0.0
Jpeg2000:CompatibleBrands=jp2
Jpeg2000:ImageHeight=nnn
Jpeg2000:ImageWidth=nnn
Jpeg2000:NumberOfComponents=3
Jpeg2000:BitsPerComponent=8 Bits, Unsigned
Jpeg2000:Compression=JPEG 2000
Jpeg2000:ColorSpecMethod=Enumerated
Jpeg2000:ColorSpecPrecedence=0
Jpeg2000:ColorSpecApproximation=Not Specified
Jpeg2000:ColorSpace=sRGB
Are there any options for transferring standard ICC profiles from images to JP2?

Re: Colour profiles & converting to JP2

Posted: 2019-02-11T08:18:36-07:00
by snibgo
IM doesn't write profiles to JP2 files.

The standard for JP2 didn't permit display profiles to be embedded until 2013. See http://wiki.opf-labs.org/display/TR/Han ... C+profiles . I don't know if whatever library IM uses for JP2 currently supports embedding profiles in JP2.

Re: Colour profiles & converting to JP2

Posted: 2019-02-11T11:13:25-07:00
by fmw42
IM uses OpenJPEG for JP2 files. I do not know if it supports profiles.

Re: Colour profiles & converting to JP2

Posted: 2019-02-11T14:24:28-07:00
by ozbigben
If it does, it would be a huge benefit to add it to IM. At present, the only option I've found that does it nicely is the J2K Photoshop plugin which is not a practical option for larger scale processing. The lack of metadata transferred is easily fixed with EXIFTool.

Re: Colour profiles & converting to JP2

Posted: 2019-02-11T15:34:39-07:00
by fmw42
Find out if OpenJPEG supports arbitrary profiles. If it does post that to the Developers forum and ask for an enhancement. No guarantees when that might happen as the developers are very busy.

Re: Colour profiles & converting to JP2

Posted: 2019-02-12T18:32:09-07:00
by ozbigben
Sounds like a good plan. I suspect it does but I will verify that. I wouldn't expect the addition to be quick but it'll be worth waiting for.