setStandbyImage method
设置待机图片 注意:调用方需先将图片缩放到目标分辨率(如 792x528)再传入字节。
imageBytes 图片编码字节(PNG/JPEG 等)
threshold 二值化阈值 0-255(默认 190)
Implementation
Future<void> setStandbyImage(
Uint8List imageBytes, {
int threshold = 190,
}) async {
var processer = Pbita(
command: 'esc',
threshold: threshold,
compress: false,
);
var info = processer.processWithBytes(imageBytes);
var fimage = info.result;
if (fimage == null || fimage.data.isEmpty) {
throw Exception('待机图片处理失败: ${info.message}');
}
await ESetStandbyImage(
device: connectedDevice(),
imageData: fimage.data,
).send();
}