Bug 263756 - [ macOS ] Enable image sub sampling for macOS
Summary: [ macOS ] Enable image sub sampling for macOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-26 18:15 PDT by Said Abou-Hallawa
Modified: 2023-10-27 17:29 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2023-10-26 18:15:16 PDT
Open these links in WebKit on macOS:

1. https://upload.wikimedia.org/wikipedia/commons/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg
2. https://cdn.esawebb.org/archives/images/large/weic2205a.jpg

Result: Display is very slow and part of the image is not shown or shown black.

This happens because these images have super gigantic sizes. The first image has size = { 30,000 x 23,756 }. Because on macOS, we do not allow image sub-sampling, the whole image has to be decoded. This will require memory with size = 30,000 x 23,756 x 4 ~= 2.85 GB. But usually we need to scale it down to the screen size which can be something like { 3,000 x 2,400 }. This means in this sase the image will be scaled down to 1/100 of its natural size. This means every 100 pixels are mapped to 1 single pixel. So we do not need to decode the image with the natural size and the natural quality in this case.

This can be fixed by using image sub sampling which will reduce the memory allocation and the decoding time. Image sub sampling is already enabled on iOS.
Comment 1 Radar WebKit Bug Importer 2023-10-26 18:15:34 PDT
<rdar://problem/117561288>
Comment 2 Said Abou-Hallawa 2023-10-26 19:12:32 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19618
Comment 3 EWS 2023-10-27 17:29:13 PDT
Committed 269875@main (a638930cea32): <https://commits.webkit.org/269875@main>

Reviewed commits have been landed. Closing PR #19618 and removing active labels.