Hehe! I have just made a small program that makes gcode of greyscale or B&W images. It is not yet finished, as I don't yet have a CNC mill, but you are welcome to use it and alter or redistribute it, if you find it useful.
It's written in PHP and takes image.png as the image file. Also $x_max, $y_max and $z_max are set to set the image size when carved. I haven't yet found a way for the image not to be mirrored and also there are no way of choosing milling diameter or steps. But look at it, use it and see what you can do:
Mind that all the "n"'s should be preceded by a backslash... Also there might be other small stuff lost in the conversion to this post.
HTML Code:<?php $file = "image.png"; $im = imagecreatefrompng($file); $size_arr = getimagesize($file); $x_max = 800; $x_factor = $size_arr[0]; $y_max = 800; $y_factor = $size_arr[1]; $z_max = 40; $z_factor = 256; $last_x = 0; $last_y = 0; $last_z = 0; echo "G01 X0 Y0 Z0\n"; for ($y=$size_arr[1]; $y>0; $y--) { for ($x=0; $x<$size_arr[0]; $x++) { $rgb = ImageColorAt($im, $x, $y); $z = $rgb; $x_pos = ($x/$x_factor*$x_max); $y_pos = ($y/$y_factor*$y_max); $z_pos = -($z/$z_factor*$z_max); echo "G01"; if ($x_pos != $last_x){ echo " X".$x_pos; $last_x = $x_pos; } if ($y_pos != $last_y){ echo " Y".$y_pos; $last_y = $y_pos; } if ($z_pos != $last_z){ echo " Z".$z_pos; $last_z = $z_pos; } echo "\n"; } } ?>