I'm trying to change image size from uint8list data.
There are lots of Image classes in Flutter as you know, and The final type of image I want to get is ui.Image.
I get Uint8List Image(.jpg) data from socket communication.
Now, I want to set the size of the image and get the Image of ui.Image at the end.
I tried to do that through (dart:ui : ui, package:image/image.dart : IMG)
IMG.Image img = IMG.decodeImage(data);
IMG.Image resized = IMG.copyResize(img, width: 400, height: 200);
ui.Codec codec = await ui.instantiateImageCodec(IMG.encodeJpg(resized));
ui.Image image = (await codec.getNextFrame()).image;
,but It freezes the app.
How can I do that? Is there any way? Thank you.
Additionally,
In "flutter/lib/src/widgets/image.dart",
Image.memory(Uint8List, width, height) can make it be easy to set image size.
Is there any way to get Uint8List from that Image widget?