Skip to content

picture.toImage is not working correctly on actual device after drawing image. #21618

@jeonghoonkim

Description

@jeonghoonkim

Steps to Reproduce

Simple code here

ui.PictureRecorder pictureRecorder = new ui.PictureRecorder();
ui.Canvas canvas = new ui.Canvas(pictureRecorder);
ui.Paint painter = new ui.Paint()

canvas.drawImageRect(SOME_IMAGE, Rect, Rect, painter);

ui.Picture pic = pictureRecorder.endRecording();

ui.Image img = pic.toImage(width, height);
ByteData byteData = await img.toByteData(format: ui.ImageByteFormat.png);

print(byteData.buffer.asUint8List()); // <- this print zeroes like, [...0,0,0,0,0,0,0,0,...]

It works fine on simulator but not on actual devices (I tested it on Nexus 5(Android), iPhone X, iPhone 6).

Can you guys please just take a look at it?

[√] Flutter (Channel dev, v0.7.3, on Microsoft Windows [Version 6.3.9600], locale ko-KR)
    • Flutter version 0.7.3 at E:\flutter\flutter_windows_v0.5.1-beta\flutter
    • Framework revision 3b309bda07 (12 days ago), 2018-08-28 12:39:24 -0700
    • Engine revision af42b6dc95
    • Dart version 2.1.0-dev.1.0.flutter-ccb16f7282

[!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
    • Android SDK at E:\android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.0
    • ANDROID_HOME = E:\android-sdk
    • Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    X Android license status unknown.

[√] Android Studio (version 3.1)
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin version 27.1.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 32-bit edition (version 1.25.1)
    • VS Code at C:\Program Files (x86)\Microsoft VS Code
    • Flutter extension version 2.18.0

[√] Connected devices (1 available)
    • Nexus 5 • 04b23c9913ad87a7 • android-arm • Android 6.0 (API 23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions