[Flutter/dart] How to convert between images and Uint8List
Overview
A library called image is useful when editing images with flutter.
This library uses image data in the type Uint8List when dealing with images.
So, this time, I will introduce how to read an image and convert it to Uint8List, and how to save Uint8List data as an image.
Method
Here's how to read an image and convert it to a Uint8List.
import 'dart:io' as io;
await io.File(imgPath).readAsBytes();
Conversely, the method for saving Uint8List type data as an image is as follows.
await io.File(savePath).writeAsBytes(imgBytes);
Recent Posts
See AllWhat want to do I want to create an input form using TextField. For example, if the input content is a monetary amount, I would like to...
What want to do There is a variable that remain unchanged once the initial value is determined. However, it cannot be determined yet when...
What want to do As the title suggests. Place two widgets in one line on the screen One in the center of the screen and the other on the...
Comentários