Raster 2 Laser GCode generator

Raster 2 Laser GCode generator is an extension to generate Gcode for a laser cutter/engraver (or pen plotter).

Similar projects worth following
Raster 2 Laser GCode generator is an extension to generate Gcode for a laser cutter/engraver (or pen plotter), it can generate various type of outputs from a simple B&W (on/off) to a more detailed Grayscale (pwm).

[Code on github ]

1) Resize the inkscape document to match the dimension of your working area on the laser cutter/engraver (Shift+Ctrl+D)

2) Draw or import the image then To run the extension go to: Extension > 305 Engineering > Raster 2 Laser GCode generator

3) Play!


View project log

Enjoy this project?



dino1963 wrote 12/15/2020 at 18:13 point

Traceback (la chiamata più recente per ultima):
  File "", riga 37, in <module>
    import png
  File "C: \ Program Files \ Inkscape \ share \ inkscape \ extensions \ ", riga 1885
    tranne ValueError, e:
SyntaxError: sintassi non valida

Qualcuno può aiutarmi?

  Are you sure? yes | no

mdtaha wrote 07/05/2020 at 09:45 point

Traceback (most recent call last):
  File "", line 37, in <module>
    import png
  File "C:\Program Files\Inkscape\share\inkscape\extensions\", line 1885
    except ValueError, e:
SyntaxError: invalid syntax

can anybody help me?

  Are you sure? yes | no

jean-marc.ariganello wrote 11/15/2020 at 09:17 point

Hello, I have the same message today. Did you fix it ? This can help me to move forward.

Thanks in advance. Regards

  Are you sure? yes | no

popovmp29 wrote 04/10/2020 at 01:55 point

Thanks!!! Thanks!!! Thanks!!! 

  Are you sure? yes | no

James wrote 10/21/2018 at 06:22 point

Can someone explain what B/W threshold and Grayscale resolution values mean?]

  Are you sure? yes | no

Naruto128 wrote 03/24/2018 at 05:28 point

hello, thank you very much for the plugin. How ¿can I select the minimum and maximum of the laser??

  Are you sure? yes | no

Curtis wrote 02/03/2018 at 02:03 point

I could use a little help, I'm pulling an image off the internet for testing as I wanted to see how well it would shade but what I was getting was almost a complete black shape. I tried various settings and still was not working. The preview that the code generates looked amazing and I thought my real results were going to match. I was wrong. Do I need to save the image as a PNG or without a background of any color. It currently had a white background. Any help would be great

Thanks. PS this is a pretty sweet plugin. I came to it for the shading feature.

  Are you sure? yes | no

Paul Candler Martinez wrote 06/24/2017 at 04:11 point

Excellent extension, great job 305 Engineering!  I use it a ton, but I wanted some extra/different functionality so I added a couple things (a dimensional test, custom header and footer scripts and a user definable max laser output power level)  Check it out at

Big shout out to y'all.  

  Are you sure? yes | no

oni305 wrote 07/17/2017 at 16:16 point

If you want to share your changes, you can contribute on github (or you can send me the code), I would be happy to share them.

  Are you sure? yes | no

bruce wrote 02/09/2017 at 17:55 point

Answer my own question here: Yes it works because I somehow didn't move the correct unzipped files! D'oh! I moved the files where you are told too and it shows up now.

  Are you sure? yes | no

bruce wrote 02/09/2017 at 16:22 point

Will Raster 2 Laser Gcode work with Inkscape 0.92 64bit version? I downloaded and installed the files into the "extension" folder and when I run Inkscape it doesn't show up.

  Are you sure? yes | no

nanou37500 wrote 09/13/2016 at 19:43 point


i use the plugin on a mac too and I don't know what to type in the "export directory", May be somebody can help me
Thank you in advance

  Are you sure? yes | no

e_bettio wrote 02/15/2017 at 05:33 point

This is a very late reply, but in case you didn’t work it out or someone else is having the same problem, the path you put in is the path from the ‘Macintosh HD’ directory

In Finder, select ‘Show Sidebar’ in the VIEW drop-down menu.

Make sure your ‘Devices’ are showing. ‘Macintosh HD’ should be one of your devices. (If you just see the ‘Devices’ heading but nothing is listed underneath, hover the cursor of ‘Devices’ and ‘show’ will appear next to it. Click on ‘show’… now you should see ‘Macintosh HD’ amongst some other things).

Click on ‘Macintosh HD’

This is the directory that the plugin is looking in. So whatever path takes you to your desired directory from here, put that path in the ‘Export Directory’ space in the plugin 

For me, the path is:

Users/my_name/Documents/MY PROJECTS AND HOBBIES/Laser Engraver/gcode output files

The subfolders from ‘MY PROJECTS AND HOBBIES’ on are folders I created.

  Are you sure? yes | no

e_bettio wrote 09/06/2016 at 02:16 point

Hi Oni305,

Thank you for creating this extension. I only use black/white but I have been using if for about a year now and think it’s great.

I have a couple of suggestions that could make it even better:

1. Add Z-axis coordinate. I have Z-axis control on my engraver (it’s a modified 3D printer) and I set the Z-axis to accommodate the laser focus and also the different thicknesses of the engraved material. A Z-axis setting would have to be done first to lift the laser above the material before it moves in the X and Y directions

2. Allow another ‘homing’ option at the end so the operator can set a custom code (I manually change the G28 to a G00 code to bring the work area forward, as homing the bed pushes it back so that it is harder to see/access).

3. One other suggestion: could there be a different speed setting when the laser is off? When there is a lot of empty space on the engraving, it can take a very long time to engrave as the laser travels quite slowly between engraving areas (I don’t have a strong laser so it moves slowly when engraving).

Just suggestions. Even without them, your extension is great.

  Are you sure? yes | no

oni305 wrote 09/08/2016 at 22:17 point

Thanks for the suggestions.
Actually I'm working on other projects, but when I'll have time I will add several features to this plugin  ^_^

  Are you sure? yes | no

hootyhoo wrote 07/13/2016 at 01:19 point

The projects I'm working on require the use of raster as well as vector.  For vector I've been using the Gcodetools plugin.  For raster I just started using Raster2Laser.  I'm having a problem with a 1mm difference between Gcodetools and Raster2Laser.  I am using the same template for both with a 1mm grid for positioning.  I get the exact same offset every single time.  

Example:  I draw a vector based box in Inkscape and export it using Gcodetools.  i then add a bmp inside the box, spacing it exactly 1mm from all of the edges, remove the box, and export using Raster2Laser.  The end result will have the image touching the top and right sides of the box with a 2 mm gap at the bottom and left sides.

Anyone know why the 2 outputs are 1mm off from each other?

  Are you sure? yes | no

oni305 wrote 07/13/2016 at 22:35 point

i don't know, but if the offset remains constant you can correct it manually.

You can try to generate gcode from Pixel from a known position with both the plugins, to see which one have the wrong offset

  Are you sure? yes | no

morviaan wrote 05/17/2016 at 14:05 point


maybe this is a dumb question, but when engraving in raster style, the laser is not always on, does this mean cooldowns are no longer needed, and can work for long hours?

thank you

  Are you sure? yes | no

ivgutier wrote 05/14/2016 at 23:45 point


I've been trying to use your plugin (on a Mac) and while the extension shows up... and I do get a preview output as well as a png output of what I need... the gcode comes out as a txt file... I also tried copying and pasting it to a gcode file... and I can't get it to work...  I'm using a prusa i3 laser cutter engraver and would appreciate your or anyone's help on this pretty please!!!

Thank you in advance

  Are you sure? yes | no

oni305 wrote 05/15/2016 at 09:56 point

yes the gcode is a simple text file.
What do you use to control the machine?

  Are you sure? yes | no

ivgutier wrote 05/15/2016 at 13:51 point

I'm using Printrun/pronterface running on a prusa i3/marlin firmware... Obviously I replaced the extruder with a laser head.... and right now I'm only able to engrave edges no fills.... 

with your script Everything seems to run fine, but the gcode isn't accurate either... I get G00, G01 and tgerefore doesn't recognize those... 

anyway, a simple find and replace function replaces all G0's for G's and so and so.... but after I've done those replacements all I get is like a shadow.... or I'm not sure how to describe it.... pronterface shows lines all over the object's area but no discernable feature....

I would greatly appreciate your help :)

  Are you sure? yes | no

oni305 wrote 05/15/2016 at 20:12 point

The Gcode is corret, the standard is G00 & G01 , if your interpter don't undersand standard gcode i can't help...

i suggest to use a better viewer for the Gcode, try this

  Are you sure? yes | no

e_bettio wrote 09/06/2016 at 02:26 point

You might have worked it all out by now, but if not:

My setup is similar: Prusa i3 with a laser fitted to the extruder body. I have no problems using the g-code output files from this extension with Marlin. I haven't tried with Pronterface but see no reason why I should. All the g-codes in the output files are recognised by Marlin. I change the file name so the extension is .gcode instead of .txt, and I add a few settings for Z-axis (and a few other minor adjustments), then put it on the SD card and tell the printer to 'print' it. 

  Are you sure? yes | no

nanou37500 wrote 09/13/2016 at 19:42 point


i use the plugin on a mac too and I don't know what to type in the "export directory", May be you can help me

Thank you

  Are you sure? yes | no

georgefomitchef wrote 01/25/2016 at 12:55 point

Looking for gcodes for engravings

We are looking for gcodes for engraving to put on our web site:

we already have some on Endurance web site. So feel free to send gcodes so we can

upload them

  Are you sure? yes | no

koswix wrote 01/24/2016 at 02:01 point

Really like the plug in, are there any plans to support smoothieboards? Don't think it would take much - on smoothie the power level is set by an S parameter given with a G1 code, and the scale is 0 to 1. Exampe:
G1 X100 Y100 S0.5 for half power.

  Are you sure? yes | no

Ariel Yahni wrote 01/23/2016 at 21:29 point

Oni, love your plugging but having trouble using it. First it seems its also considering the background and will issua just a square box. Second GRBL seems to expect SXXXX and gcode from plugging is SXXX. What am i missing?

  Are you sure? yes | no

oni305 wrote 01/24/2016 at 00:46 point

1) Yes the puggin work on *everything* inside the document, so the firs step is to resize it.
(btw: don't use white to fill the background but leave it transparent)

2) by default GRBL use a value betwen 0 and 1000 for the spindle (S), you have to recompile GRBL editing line 246 of "config.h" and set it to 256.0 :

#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.

  Are you sure? yes | no

Rjpope42 wrote 01/04/2016 at 06:34 point

Just wanted to let you know it works great, and I like it!

The only feature request I would have is a power scalar multiplier, where you could do something like set "black" to half power, to keep from having to adjust the  power manually every time.


  Are you sure? yes | no

oni305 wrote 01/05/2016 at 13:08 point

It's already scheduled, but i'm pretty busy right now

  Are you sure? yes | no

dechemist wrote 12/13/2015 at 19:07 point


nice plugin ! I just tested it with my laser plotter ( and it works great ! I will update my blog with a picture of the result soon.

I just have to find good parameters (speed and laser power) to engrave thick paper and dont burn through :) Ply wood should work with full power and F100 though.

  Are you sure? yes | no

oni305 wrote 12/14/2015 at 16:15 point

Thanks ^_^

  Are you sure? yes | no

eschuyler wrote 05/12/2015 at 16:02 point


Never mind - I'm an idiot! I downloaded your files individually *with HTML formatting*, instead of the ZIP file. Once I got the correct files, everything works fine.


  Are you sure? yes | no

oni305 wrote 05/12/2015 at 21:08 point

excellent  ^^

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates