Please or Register to create posts and topics.

Grayscale conversion leaves pure black as white

OK so this is a strange one, So I have attached two files, the original and the grayscale preview.

Now what seems to happen is where in the image it is supposed to be real black (almost black is unaffected) it changes to white in the preview. Look at the eyebrows and the trees in the preview image.

Now this white (I am using CNCjs) it keeps the power on the laser and kind of skips it, i.e it speeds up as it does each of these parts which looks really strange.

Now I am also wondering if it is doing the same to actual white as well as something that is white in the image looks burnt the same way rather than white.

Does anybody else see this?

Uploaded files:
  • VampiresRocks.gcode_.png
  • VampiresRocks.gcode_Gray_128_preview.png

OK so a small change to the Python, untested as yet as it's 1 degree outside but the image now looks right.

line 416 excluded black (0) for some reason.

It was:
if matrice[y][x] >0 and matrice[y][x] <254:

if matrice[y][x] >=0 and matrice[y][x] <254:


Hope that helps 🙂

Uploaded files:
  • Broken.png
  • Fixed.png

Argh sorry, that was me posting from a different machine!


Not only was it the wrong machine it was also the wrong code, see below!

It was:
if matrice[y][x] >1 and matrice[y][x] <254:

if matrice[y][x] >=0 and matrice[y][x] <254:

The colours are converted into grayscale via an algorithmin the Inkscape plugin. You can convert it yourself first via a photoshop or paint program and then upload it into inkscape.

let me know if that works.

It's interesting that I only see this effect with greyscale resolutions 8 thru 128.  At a resolution of 256 the black is true black.  Wit the fix you are suggesting all resolutions have true black - looks like it works but will it cause any other issues?  I will try this with some other prints to see if anything else changes.

I see the same positive effect with line 416 set to

if matrice[y][x] >=1 and matrice[y][x] <254:

Hi Dave once I got my k40 back at home I will investigate. Maybe it is indeed a software bug. Will report back to you with a few days, cheers, Paul

Cheers, Paul awesome.tech

Forum Registration