NEW 230855
Canvas memory limit of 4096 × 4096 pixels when calling ctx.getImageData
https://bugs.webkit.org/show_bug.cgi?id=230855
Summary Canvas memory limit of 4096 × 4096 pixels when calling ctx.getImageData
Bramus
Reported 2021-09-27 13:21:35 PDT
Spotted on Twitter [1], by Rik Schennink “Safari 15 has a canvas memory limit of 4096 × 4096 pixels where Safari 14 could deal with resolutions up to 16384 x 16384” Can verify via the CodePen Demo [2] Rik also shared, in which he creates a 4097x4097 canvas. Upon calling `ctx.getImageData(0, 0, size, size)` the code fails. “Unable to get image data from canvas. Requested size was 4097 x 4097” While searching for bugs I did find [3] where the limit was added for iOS, but this is now applied on macOS too apparently. Is this a regression? [1] https://twitter.com/rikschennink/status/1442443774748082185 [2] https://codepen.io/rikschennink/pen/YzQRdwZ [3] https://bugs.webkit.org/show_bug.cgi?id=145998
Attachments
Bramus
Comment 1 2021-09-27 13:23:15 PDT
I read in https://bugs.webkit.org/show_bug.cgi?id=229237 that the “2D memory limit” test got marked as expected to Crash, so I guess that that explains why this went undetected?
Bramus
Comment 2 2021-09-28 02:40:03 PDT
Update: Creating a canvas of 16384 x 16384 on macOS and drawing on it still works. It's only when calling `ctx.getImageData` that Safari fails to cooperate.
Kevin Neal
Comment 3 2021-09-29 08:22:24 PDT
Thank you for filing. The appropriate engineers have been notified.
Radar WebKit Bug Importer
Comment 4 2021-09-29 08:22:34 PDT
Myles C. Maxfield
Comment 5 2021-10-12 16:45:33 PDT
Myles C. Maxfield
Comment 6 2021-10-12 16:46:34 PDT
static const float MaxClampedLength = 4096; static const float MaxClampedArea = MaxClampedLength * MaxClampedLength;
Myles C. Maxfield
Comment 7 2021-10-12 16:47:39 PDT
Simon Fraser (smfr)
Comment 8 2021-10-12 16:54:33 PDT
Or by the GPU Process?
Note You need to log in before you can comment on or make changes to this bug.