Open HappySeaFox opened 3 years ago
According to ISO/IEC 15444-1:2000, I.5.3.3, an ICC profile is in a Colour Specification box, named ‘colr’, starting at zero-based offset 3, iff the first octet, the METH field, is equal to 0x02 (Restricted ICC profile). There may be multiple such boxes. They are located within the JP2 Header superbox, named ‘jp2h’.
Jasper already contains JP2_BOX_COLR/JP2_COLR_ICC handling. The ‘colr’ box is saved within jp2_dec_t::colr->colr
. Jasper, in fact, appears to have its own colour management handling.
jas_image_cmprof()
retrieves an image's colour management profile, which has an iccprof
field. jas_iccprof_createfromcmprof()
creates a copy of it, and jas_iccprof_save()
will serialize it in the normal format. This has the property that you might be able to receive a made-up but appropriate profile, even if there is no actual profile in the file.
I've typed this out as I was trying to figure out the current situation. I haven't tried doing CM with Jasper yet.
I think that you can create a memory stream (i.e., buffer in memory) with jas_stream_memopen and then use jas_iccprof_save to write the ICC profile to the stream. You then have a copy of the ICC profile in your memory buffer. Would this not work?
I would expect problems with v4 profiles. Jasper would probably profit from being able to use a different CMM, such as Little-CMS, Chrome's Skia (SkCMS), or Firefox's qcms (this one doesn't support all v4 profiles).
Hi! 😀
It would be great if jasper gives access to the raw ICC profile if the loaded image has it. Like libjpeg or libpng does. Raw profile = binary data and its length. Like that:
It's also discussible if this function should allocate
icc
, or just return an already existing internal pointer.