Future<ByteData?> imageToBytes(ui.Image image) async { final bytes = await image.toByteData(format: ui.ImageByteFormat.rawRgba); return bytes; }