Skip to content

[web] instantiateImageCodecWithSize hardcodes allowUpscaling: false, breaking ResizeImage(allowUpscaling: true) #195193

Closed

Description

@harryterkelsen

Description

In engine/src/flutter/lib/web_ui/lib/painting.dart, instantiateImageCodecWithSize invokes getTargetSize(width, height) (where ResizeImage has already enforced its own allowUpscaling parameter) and then passes a hardcoded allowUpscaling: false to engine.engineInstantiateImageCodec:

final TargetImageSize targetSize = getTargetSize(width, height);
return await engine.engineInstantiateImageCodec(
  buffer._list!,
  targetWidth: targetSize.width,
  targetHeight: targetSize.height,
  allowUpscaling: false,
);

On native (dart:ui), instantiateImageCodecWithSize scales to whatever TargetImageSize is returned by getTargetSize, leaving upscaling policy to the caller (ResizeImage.allowUpscaling). Because the web implementation hardcodes allowUpscaling: false, ResizeImage(..., allowUpscaling: true) clamps target dimensions back down to the intrinsic image size on web.

Note: packages/flutter/test/painting/image_provider_resize_image_test.dart (line 622) still skips its ResizeImage group on isBrowser referencing closed #73120.

Steps to Reproduce

  1. Remove skip: isBrowser on line 622 of packages/flutter/test/painting/image_provider_resize_image_test.dart.
  2. Run:
    flutter test --platform chrome test/painting/image_provider_resize_image_test.dart

Expected Results

All ResizeImage tests pass on Chrome (both CanvasKit and Skwasm), upscaling images when allowUpscaling: true is specified.

Actual Results

16 allowUpscaling: true test cases fail because the decoded ui.Image remains at its intrinsic dimensions instead of scaling up to the size returned by getTargetSize.

Activity

  1. added
    P2Important issues not at the top of the work list
    team-webOwned by Web platform team
    triaged-webTriaged by Web platform team
    on Oct 23, 2026
  2. added a commit that references this issue on Oct 26, 2026
    8df7006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions