Bug 248249 - Some valid JP2s are failing to decode
Summary: Some valid JP2s are failing to decode
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 16
Hardware: Unspecified All
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2022-11-22 16:13 PST by Eric Portis
Modified: 2022-11-24 15:37 PST (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Eric Portis 2022-11-22 16:13:12 PST
This valid JPEG2000 file does not decode in Safari 16 running on macOS Ventura 13.0.1, MacOS Monterey 12.6, or iOS 16.1.1.


- Changing the image slightly (resizing by one pixel) causes it to work: https://assets.meinauto.de/image/upload/f_jp2,w_3248/v1668594966/website/pics/landingpages/black-deals/red
- This bug seems *very* related to FB9671920 / https://bugs.webkit.org/show_bug.cgi?id=219977

I have cross-filed this as FB11815925, and fully expect this WebKit bug to be closed as RESOLVED INVALID, because the bug is in the media handling layers in the OS. However previous experience has shown it is valuable to have a public URL to reference and share resources/workarounds when others run into this bug in Safari.
Comment 1 Eric Portis 2022-11-22 16:15:01 PST
I should also note it seems extremely related to https://bugs.webkit.org/show_bug.cgi?id=219977 & FB9671920, which seems to have been recently fully fixed?

Just as with that bug, the issue only seems to affect very "simple" images (for example, but not limited to: single-color images).

I will update both this and the feedback as I find more examples of failing JP2s.
Comment 2 Eric Portis 2022-11-22 16:37:37 PST
The JP2s seem to fail consistently when they are over a certain size.

Setting the "width" parameter in this URL to anything over 3248 generates a failing image:


Anything under 3248 succeeds:


Changing the color space to CMYK seems to change this boundary to 3260

https://assets.meinauto.de/image/upload/f_jp2,w_3260,cs_cmyk/website/pics/landingpages/black-deals/red (WORKS)

https://assets.meinauto.de/image/upload/f_jp2,w_3261,cs_cmyk/website/pics/landingpages/black-deals/red (FAILS)
Comment 3 Radar WebKit Bug Importer 2022-11-22 20:24:16 PST
Comment 4 Sam Sneddon [:gsnedders] 2022-11-23 04:11:13 PST
> I have cross-filed this as FB11815925

Comment 5 Sam Sneddon [:gsnedders] 2022-11-24 06:09:06 PST
Karl: not sure how this is BrowserCompat? failing to decode JPEG2000 arguably just makes us behave the same as everyone else (who don't support JPEG2000); I guess it could lead to site compat problems with usage of content negotiation or similar, as we'll get served a JPEG2000 image and then fail to render it.
Comment 6 Karl Dubost 2022-11-24 15:37:25 PST
Hmm Indeed. Sorry about that.