Skip to content

After capturing with RepaintBoundary, the background color of the image is distorted. #175160

@BMWrc

Description

@BMWrc

Steps to reproduce

I’m working on sharing images by capturing widgets. About five months ago, it worked fine, but now it converts the data to bytes and causes the image colors to be distorted. Here’s a snippet of my code

Could this issue be caused by the iOS version? Has anyone else encountered the same problem, or is there a way to fix it? Please help me.

Expected results

resolve problem and best practice

Actual results

share Image show right this,

Code sample

try {
final boundary = _key.currentContext!.findRenderObject()!
as RenderRepaintBoundary;
final image = await boundary.toImage(pixelRatio: 3);

  final byteData = await image.toByteData(
    format: ui.ImageByteFormat.png,
  );
  final pngBytes = byteData!.buffer.asUint8List();

} catch (e) {
  debugPrint('Share Image: $e');
}

Screenshots or Video

Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

[✓] Flutter (Channel stable, 3.32.8, on macOS 15.5 24F74 darwin-arm64, locale en-TH)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.103.2)
[✓] Connected device (3 available)
! Error: Browsing on the local area network for iPhone ของ jarin. Ensure the device is unlocked and attached
with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions