> 16) & 0xFF) / 32); $g = round((($col >> 8) & 0xFF) / 32); $b = round(($col & 0xFF) / 32); $id = $r.$g.$b; //echo $id."\n"; if(!in_array($id,$colors)){ $colors[] = $id; } } } $pixels_per_wait = 200; $ppw_count = 0; foreach ($colors as $col) { $r = $col[0]; $g = $col[1]; $b = $col[2]; //fwrite($file,"wait\n10\n"); fwrite($file,"inv_fields\n\nreturn {s_blue=\"CHG:$b\",s_green=\"CHG:$g\",s_red=\"CHG:$r\"}\n"); for ($y=0; $y < imagesy($im); $y++) { for ($x=0; $x < imagesx($im); $x++) { $val = imagecolorat($im,$x,$y); $r = round((($val >> 16) & 0xFF) / 32); $g = round((($val >> 8) & 0xFF) / 32); $b = round(($val & 0xFF) / 32); $id = $r.$g.$b; $x2 = $x + $offx; $y2 = $y + $offy; if($id == $col){ fwrite($file,"draw\n0\n$x2\n$y2\n"); $pixelprogress++; if($pixels_per_wait>0){ $ppw_count++; if($ppw_count == $pixels_per_wait){ $ppw_count = 0; echo "\rconversion progess ".round(($pixelprogress/$pixelcount)*100)."%"; fwrite($file,"print\nprinting progess ".round(($pixelprogress/$pixelcount)*100)."%\n"); fwrite($file,"wait\n1\n"); } } } } } } fwrite($file,"wait\n10\n"); fwrite($file,"say\nhttps://bowels-of-the.macrofox.org/git/mtpt/canvas_printer\n"); fwrite($file,"wait\n2\n"); fwrite($file,"exit");