Bug 244528

Summary: [GTK][WPE] Decoding artifacts in JPEG2000 images
Product: WebKit Reporter: Adrian Perez <aperez>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: agomez, sabouhallawa
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=178758
https://bugs.webkit.org/show_bug.cgi?id=186272
Attachments:
Description Flags
Screenshot showing the same JPEG2000 file loaded in Epiphany/WebKitGTK, and GIMP
none
Example JP2 which shows decoding artifacts none

Description Adrian Perez 2022-08-30 00:49:15 PDT
Created attachment 462000 [details]
Screenshot showing the same JPEG2000 file loaded in Epiphany/WebKitGTK, and GIMP

This can be seen browsing the Epson website, e.g. https://www.epson.co.uk
and in particular the big carousel images, like this one: 

  https://i8.amplience.net/i/epsonemear/home_0722_cashback-slide_uk?$ct2-xl-img1$&$poi$&fmt=jp2

(The website uses “fmt=auto” in the URL, which makes the server use JPEG2000
when loading the URL with WebKitGTK/WPE based browsers; but I have replaced the
link here to have “fmt=jp2” to force the download of the JP2 file when opened
in browsers that do not support the format.)

I am attaching a screenshot of Epiphany (WebKitGTK) and GIMP displaying the
aforementioned file, where the artifacts can be seen, for those who cannot
load JP2 files in their browsers.
Comment 1 Adrian Perez 2022-08-30 00:50:43 PDT
Created attachment 462001 [details]
Example JP2 which shows decoding  artifacts

Here's the JP2 file, in case it disappears from the web.
Comment 2 Adrian Perez 2022-08-30 01:15:28 PDT
One more data point: in the testing I have been doing, both WebKit
and GIMP are using the same OpenJPEG library, version 2.5.0:

  % readelf -d /usr/lib/gimp/2.99/plug-ins/file-jp2-load/file-jp2-load | grep 'NEEDED.*openjp'
   0x0000000000000001 (NEEDED)             Shared library: [libopenjp2.so.7]
  % readelf -d /usr/lib/libwebkit2gtk-4.1.so | grep 'NEEDED.*openjp'
   0x0000000000000001 (NEEDED)             Shared library: [libopenjp2.so.7]

Not sure if related, but trying to open the following JP2 image will
show an empty white rectangle in WebKitGTK/WPE (again, GIMP opens it
just fine):

  https://github.com/openpreserve/format-corpus/blob/master/jp2k-formats/balloon.jp2

The same image can be found here, with JP2 files produced using different
encoders, WebKit loads them all fine except for “balloon_aware.jp2”, which
loads as transparent pixels (GIMP opens it fine):

  https://github.com/openpreserve/format-corpus/tree/master/jp2k-test/resolution

The following one seems to be decoded as completely transparent pixels as
well (and GIMP has trouble with it as well, it shows it as mostly pure green
pixels with some small black spots):

  https://www.fnordware.com/j2k/jp2samples.html
Comment 3 Andres Gomez Garcia 2022-08-30 01:20:03 PDT
Thanks for reporting this, Adrián.