Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop on netlify web got transparant image #9

Open
Mumunt opened this issue Apr 13, 2022 · 3 comments
Open

Crop on netlify web got transparant image #9

Mumunt opened this issue Apr 13, 2022 · 3 comments

Comments

@Mumunt
Copy link

Mumunt commented Apr 13, 2022

I used this package on local, it works perfectly. But when i try on netlfy, it return transparent image.

this is my code to get image from croppedBitMap to Uint8List

ui.Image bitmapImage = await controller.croppedBitmap(
                              quality: FilterQuality.medium);
                          ByteData? byteData = await bitmapImage.toByteData(
                              format: ui.ImageByteFormat.png);

                          Uint8List pngImage = byteData!.buffer.asUint8List();

                          print("pngImage : $pngImage");

this is result of pngImage on netlify

pngImage : [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 3, 53, 0, 0, 0, 144, 8, 6, 0, 0, 0, 49, 213, 69, 44, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8, 124, 8, 100, 136, 0, 0, 1, 225, 73, 68, 65, 84, 120, 156, 237, 193, 49, 1, 0, 0, 0, 194, 160, 245, 79, 109, 12, 31, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 120, 26, 56, 57, 0, 1, 238, 1, 50, 108, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]

i used this build command for deploy my proj to netlify. I try html rendering and also canvaskit rendering but got nothing.
if cd flutter; then cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --web-renderer canvaskit --release

flutter doctor

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-x64, locale en-GB)
    • Flutter version 2.10.3 at /Users/arifwahyu/Documents/tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (6 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/arifwahyu/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2021.1)
    • 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.11+0-b60-7590822)

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.88

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@deakjahn
Copy link
Owner

Unfortunately, I don't have the slightest idea of what Netify is. :-)) But the very first question is, if we speak about Flutter Web, do you use the CanvasKit renderer? The old renderer is very much to be avoided these days.

@Mumunt
Copy link
Author

Mumunt commented Apr 13, 2022

Im sorry, i mean Netlify, not Netify. Netlify can be found on netlify.com. I did test for html rendering and canvas rendering and got nothing. The weird part is when i test it on local, it works.

@deakjahn
Copy link
Owner

deakjahn commented Apr 13, 2022

The 'l' doesn't help me any further, I don't know that either (yes, I can see the web page but I have no idea how it works under the hood). You can check out the actual JS Flutter uses to convert the canvas to an image in the engine source code but I'm not sure that will help much.

As a first step, I would try to draw anything to a canvas, a red rectangle or similar and check how that converts to a PNG. More or less like in

Future<ui.Image> croppedBitmap(
, but not drawImageRect() but some other drawing function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants