Repository: flutter
Issue: Cannot decode JPEG on flutter web
Labels: engine,platform-web,a: images,c: rendering,e: web_canvaskit,has reproducible steps,P2,browser: chrome-desktop,e: web_skwasm,team-web,triaged-web,found in release: 3.22,found in release: 3.23

### Steps to reproduce

1. Download and build the project available [here](https://github.com/sgehrman/jpeg_bug).
2. Build and run the project on desktop, mobile and web.
3. The JPEG image located at `jpeg_bug/assets/badJpeg.jpg` renders fine on desktop and mobile, but shows as a black rectangle on web (Chrome).

### Expected results

The JPEG image at path `jpeg_bug/assets/badJpeg.jpg` in [this](https://github.com/sgehrman/jpeg_bug) project should render normally in a web application.

### Actual results

The JPEG image at path `jpeg_bug/assets/badJpeg.jpg` in [this](https://github.com/sgehrman/jpeg_bug) project should renders as a black rectangle.

### Code sample

Code available [here](https://github.com/sgehrman/jpeg_bug).

### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6 23G5052d darwin-arm64, locale en-US)
    • Flutter version 3.22.2 on channel stable at /Users/milke/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (4 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.6 23G5052d darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.6 23G5052d darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 126.0.6478.127

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
```

</details>