image method

  1. @override
Future<bool> image(
  1. Uint8List image, {
  2. int threshold = 150,
})
override

Implementation

@override
Future<bool> image(Uint8List image, {int threshold = 150}) async {
  final decodedImage = img.decodeImage(image)!;

  var imgData = ImageData(width: decodedImage.width, height: decodedImage.height);
  final converted = toPixel(imgData, paperWidth: width, dpi: dpi, isTspl: false);

  // final resizedImage = copyResize(decodedImage, width: converted.width, height: converted.height, interpolation: Interpolation.cubic);

  final ms = 1000 + (converted.height * 0.5).toInt();

  return await sendToConnector(() {
    // final printerImage = generator.image(resizedImage, threshold: threshold);
    List<int> bytes = [];
    // bytes += generator.reset();
    // bytes += generator.setLineSpacing(0);
    // bytes += printerImage;
    // bytes += generator.resetLineSpacing();
    // bytes += generator.cut();
    return bytes;
  }, delayMs: ms);
}