Giter Club home page Giter Club logo

Comments (9)

deakjahn avatar deakjahn commented on July 23, 2024

Then save it for yourself. You can use

data = await image.toByteData(format: ImageByteFormat.png)

to make a PNG out of it,

bytes = data!.buffer.asUint8List()

to get the byte data and you can easily save that to a File:

file.writeAsBytes(bytes, flush)

from crop_image.

vannakyet avatar vannakyet commented on July 23, 2024

thanks you very much.

from crop_image.

muddi900 avatar muddi900 commented on July 23, 2024

I am getting this error when I try the above method:

E/FlutterJNI( 9460): Failed to decode image
E/FlutterJNI( 9460): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
E/FlutterJNI( 9460): 	at android.graphics.ImageDecoder.nCreate(Native Method)
E/FlutterJNI( 9460): 	at android.graphics.ImageDecoder.access$200(ImageDecoder.java:169)
E/FlutterJNI( 9460): 	at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:246)
E/FlutterJNI( 9460): 	at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1754)
E/FlutterJNI( 9460): 	at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1747)
E/FlutterJNI( 9460): 	at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:431)

════════ Exception caught by image resource service ════════════════════════════
The following _Exception was thrown resolving an image codec:
Exception: Invalid image data

When the exception was thrown, this was the stack
#0      _futurize (dart:ui/painting.dart:5394:5)
#1      ImageDescriptor.encoded (dart:ui/painting.dart:5262:12)
#2      instantiateImageCodec (dart:ui/painting.dart:2048:60)
<asynchronous suspension>
Path: /data/user/0/com.ilmdp.tennis_tennis_love/cache/image.png

from crop_image.

deakjahn avatar deakjahn commented on July 23, 2024

You have to check what's inside your image data. This is an exception from the painting routines of Flutter's engine, not this plugin.

from crop_image.

muddi900 avatar muddi900 commented on July 23, 2024

I was using Uint64list. It was resolved when I switched to 8 bits. Thanks.

from crop_image.

swapnilsinha17 avatar swapnilsinha17 commented on July 23, 2024

@vannakyet Please let me know how you do this bitmap to file

from crop_image.

Shubham-Narkhede avatar Shubham-Narkhede commented on July 23, 2024

data = await image.toByteData(format: ImageByteFormat.png)

what is this image.toByteData. From where we can create this image can you please let me know @deakjahn @vannakyet

from crop_image.

deakjahn avatar deakjahn commented on July 23, 2024

A small error in the README. There are two Image types, ui.Image and the plain Image. The toByteData() function belongs to the first one. It will be fixed in the coming version.

from crop_image.

Shubham-Narkhede avatar Shubham-Narkhede commented on July 23, 2024

@deakjahn Thanks

from crop_image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.