Skip to content

Conversation

@mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Nov 6, 2025

Fixes #122331

Build with image codecs (before) without image codecs (after) Difference %
canvaskit_chromium 1.54 MB 1.45 MB $${\color{green}9\%}$$
canvaskit_webparagraph 1.12 MB 1.01 MB $${\color{green}10\%}$$

@github-actions github-actions bot added the engine flutter/engine related. See also e: labels. label Nov 6, 2025
@github-actions github-actions bot added the platform-web Web applications specifically label Nov 7, 2025
@kevmoo
Copy link
Contributor

kevmoo commented Nov 7, 2025

This makes uploaded bits smaller, right? By how much?
Have we confirmed on older Chrome builds? When was this fixed?

@mdebbar
Copy link
Contributor Author

mdebbar commented Nov 7, 2025

This makes uploaded bits smaller, right? By how much?

Yes, added the numbers to the PR description. It's ±100KB smaller.

Have we confirmed on older Chrome builds? When was this fixed?

This PR is a no-op for apps (other than making CanvasKit's size smaller). The web engine has been using the browser ImageDecoder exclusively on Chrome for quite a while now. There was one remaining edge case that required Skia decoders, but that was addressed in flutter/engine#53201 more than a year ago.

TL;DR: Flutter web apps today in Chrome are already not using the Skia decoders. This PR is removing the unused decoders to save size.

@mdebbar mdebbar marked this pull request as ready for review November 12, 2025 20:40
Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nit


void _imageTests() {
test('MakeAnimatedImageFromEncoded makes a non-animated image', () {
if (configuration.canvasKitVariant == CanvasKitVariant.chromium) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use skip: instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the first thing I tried :)

It doesn't work because the configuration object is initialized after skip is evaluated. The configuration value is initialized in a setUpAll callback, so the only reliable place to get the correct value of configuration.canvasKitVariant is inside the test body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web] Remove image codecs from CanvasKit Chromium

3 participants