Skip to content

[Impeller] App crashes on image compression in Skia with wide-gamut enabled. #133942

@Hari-07

Description

@Hari-07

Is there an existing issue for this?

Steps to reproduce

  1. This snippet was adapted from flutter_cache_manager
  2. Look at snippet below
  3. The particular image url I'm using is link

Expected results

Both calls to toByteData should work without errors

Actual results

After upgrading to 3.13, on a physical device (Tested on iphone 14 pro)

.toByteData(format: ui.ImageByteFormat.png)

throws error

[VERBOSE-2:image_encoding.cc(123)] Could not convert raster image to PNG.
_TypeError: Null check operator used on a null value
  File "painting.dart", line 1959, in _Image.toByteData.<fn>.<fn>

However running with --no-enable-impeller seems to run without error.

FYI the image is a jpeg. I'm not sure if JPEG images are supposed to work with ImageByteFormat.png however it does work when not using impeller, so definitely seems like a regression

Code sample

Code sample
  void test() async {
    final img = NetworkImage(_imageUrl);

    final im = await _decodeImage(img);

   await im.toByteData();
   await im.toByteData(format: ui.ImageByteFormat.png);
  }

  Future<ui.Image> _decodeImage(
    ImageProvider imageProvider,
  ) {
    final image = imageProvider;
    final completer = Completer<ui.Image>();
    image.resolve(ImageConfiguration.empty).addListener(
      ImageStreamListener((info, _) {
        completer.complete(info.image);
        image.evict();
      }),
    );
    return completer.future;
  }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
hari@<name>-MacBook-Pro <app> % flutter doctor -v
[✓] Flutter (Channel stable, 3.13.1, on macOS 13.5.1 22G90 darwin-arm64, locale en-IN)
    • Flutter version 3.13.1 on channel stable at /Users/<name>/Softwares/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (12 days ago), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/<name>/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 70.0.5
    • Dart plugin version 222.3345.108

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (4 available)
    • iPhone (mobile) • 00008120-001444280A00C01E            • ios            • iOS 16.6 20G75
    • iPhone 14 Pro (mobile)       • BCD80EB9-B8A8-43F9-9D7F-D96DF7A457CD • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)              • macos                                • darwin-arm64   • macOS 13.5.1 22G90 darwin-arm64
    • Chrome (web)                 • chrome                               • web-javascript • Google Chrome 116.0.5845.140
    ! Error: iPhone is busy: Fetching debug symbols for Harinandan’s iPhone. Xcode will continue when Harinandan’s iPhone is finished. (code -10)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions