[Webkit-unassigned] [Bug 216645] [iOS 14] WebP images do not handle color profiles correctly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 28 01:25:53 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=216645

Jon Sneyers <jon at cloudinary.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jon at cloudinary.com

--- Comment #3 from Jon Sneyers <jon at cloudinary.com> ---
It looks like Chrome on iOS 14 and UIImage on iOS 14 have the same problem: it seems like an ICC profile in a WebP gets ignored, causing e.g. images with the Display P3 profile to look desaturated (presumably because they are misinterpreted as sRGB).

I don't have access to the Core Image source code so I don't know how WebP suppport was implemented, but it's quite easy to forget about ICC profiles. To not ignore the ICC profile, you need to not just call the simple one-stop high-level decode function WebPDecodeRGBA(), but you also need to include webp/demux.h and do something like this:

  WebPDemuxer* demux = WebPDemux(&webp_data);
  uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
  // ... (Extract metadata).
  WebPChunkIterator chunk_iter;
  if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
  // ... (Consume the ICC profile in 'chunk_iter.chunk').
  WebPDemuxReleaseChunkIterator(&chunk_iter);
  WebPDemuxDelete(demux);

I hope this helps and we can avoid having to convert/clamp WebP images to the sRGB gamut!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201028/1824bbfc/attachment-0001.htm>


More information about the webkit-unassigned mailing list