mike42/escpos-php - 图片维度

mike42/escpos-php - image dimension

我有一个大的 PNG 文件,我想通过 ESCPOS-PHP 库打印它。我知道有类似 MODE_DOUBLE_WIDTH 的东西,但是我的图片已经很大了,所以我想把它变小。

但是我一直在寻找设置图像文件尺寸的参数,是否有任何参数可以通过编程方式调整图像大小(将大小设置为 20x20)。

mike42/escpos-php不会有转换图片数据大小的功能
文档没有提到,源码也没有这个功能。

如果你想将一些图像数据文件转换成特定垂直和水平点大小的数据,请使用除mike42/escpos-php或语言函数之外的其他库。


文档:
graphics(EscposImage $image, $size)

Print an image to the printer.

Parameters:

  • EscposImage $img: The image to print.
  • int $size: Output size modifier for the image.

Size modifiers are:

  • IMG_DEFAULT (leave image at original size)
  • IMG_DOUBLE_WIDTH
  • IMG_DOUBLE_HEIGHT

The function bitImage() takes the same parameters, and can be used if your printer doesn't support the newer graphics commands. As an additional fallback, the bitImageColumnFormat() function is also provided.

源代码:
escpos-php/src/Mike42/Escpos/EscposImage.php
escpos-php/src/Mike42/Escpos/GdEscposImage.php
escpos-php/src/Mike42/Escpos/ImagickEscposImage.php


IMG_DEFAULTIMG_DOUBLE_WIDTHIMG_DOUBLE_HEIGHT的说明是ESC/POS命令的参数中指定的值,不是转换图像数据的功能。

ESC *
GS /
GS Q 0
GS v 0