diff --git a/lib/src/jpegrutils.cpp b/lib/src/jpegrutils.cpp index 3f064ade..a1b0ac86 100644 --- a/lib/src/jpegrutils.cpp +++ b/lib/src/jpegrutils.cpp @@ -729,6 +729,9 @@ uhdr_error_info_t getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, uint8_t metadata->offset_hdr[c] = 0.0f; } metadata->hdr_capacity_min = 1.0f; + // Apple applies the gain map in the base image's color space, and its gain-map + // image carries no ICC profile. + metadata->use_base_cg = true; float max_content_boost; bool present = false; diff --git a/tests/jpegr_test.cpp b/tests/jpegr_test.cpp index 8748dac1..019c0b85 100644 --- a/tests/jpegr_test.cpp +++ b/tests/jpegr_test.cpp @@ -1753,6 +1753,7 @@ TEST(JpegRTest, decodeApple) { } EXPECT_EQ(gainmapMetadata->hdr_capacity_min, 1.0f); EXPECT_FLOAT_EQ(gainmapMetadata->hdr_capacity_max, headroom); + EXPECT_TRUE(gainmapMetadata->use_base_cg); uhdr_release_decoder(dec); }