相关疑难解决方法(0)

使用PHP或Javascript为Zebra打印机将RGB图像转换为Floyd-Steinberg图像

我正在开发一个基于桌面的PHP应用程序,我们需要捕获一个人的图像并使用Zebra GC420t打印机将其打印在标签上预期的图像应该如下图所示.

在此输入图像描述

当我尝试打印时,它会输出如下图所示的输出.

在此输入图像描述我使用以下代码使用代码将rgb图像转换为图像ditheringphp

 $photo_url="";
if(isset($_GET['photo'])){
  $photo_url=$_GET['photo'];
}

function image2grf($filename='$photo_url', $targetname = 'R:IMAGE.GRF')
{
  $info = getimagesize($filename);
  $im = imagecreatefrompng($filename);
  $width = $info[0]; // imagesx($im);
  $height = $info[1]; // imagesy($im);
  $depth = $info['bits'] ?: 1;
  $threshold = $depth > 1 ? 160 : 0;
  $hexString = '';
  $byteShift = 7;
  $currentByte = 0;
  // iterate over all image pixels
  for ($y = 0; $y < $height; $y++) {
    for ($x = 0; $x < …
Run Code Online (Sandbox Code Playgroud)

javascript php image-processing dithering zebra-printers

7
推荐指数
1
解决办法
308
查看次数