top of page

[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 All

Comentários


category

Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page