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?



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 3 days ago 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

eschuyler wrote 05/12/2015 at 15:49 point

Hello Stefano,

I am trying to install your Inkscape extension. I have Inkscape 0.91 (Windows) installed, and I copied the three files into the Inkscape\share\extensions folder. When I run Inkscape, your extension is not listed. I ran and got many error messages when it tried to create the Raster2Laser extension. Can you suggest what I'm doing wrong? I can send a file of all of the messages, if that would help.


  Are you sure? yes | no

IW0HJZ wrote 04/05/2015 at 08:47 point

Hi Stefano, nice , it work for me.

I'm following even the forum on open build about your board.

Great job, would like to ask about laser U use....iw0hjzatgmaildotcom is my address.

Once again , good job.

ciao Alberto

  Are you sure? yes | no

oni305 wrote 04/09/2015 at 16:45 point

one of my mail is   305engineering at gmail dot com

  Are you sure? yes | no

IW0HJZ wrote 04/03/2015 at 15:43 point

Hi oni305, yep probabily you are right, this work only for fix theresold.

At the moment I'm play with the various parameters.... a lot of  possibilities.

Thanks again, at the moment I'm using a gbrl firmware with a protoneer shield on arduino uno.

following the upgrades.....

alberto IW0HJZ

  Are you sure? yes | no

oni305 wrote 04/04/2015 at 13:12 point

In any case, I have already added your suggestions to the code!  :D
Now the generated  files have a suffix to show some more info over the filename.

Comunque ho già aggiunto i tuoi suggerimenti al codice! :D
Ho aggiunto un suffisso ai file per mostrare pù informazioni oltre al nome

Stefano oni305

  Are you sure? yes | no

IW0HJZ wrote 03/30/2015 at 20:51 point

Hi there, I'm tryng your script on my homemade laser engrave, really simple one, based on grbl firmware and it work pretty well.

I have had  a problem with universal gcode sender(java) because the first line in the gcode ( seem to be too long), modified the code with a short "generated 305".

Do you think will be possible to use the theresold number in fix b/w option as numeric part of the file name, this will help to select the right file on the fly only looking at the name.

Ciao , grazie per l'ottimo script che funziona molto bene, lo sto provando in questi giorni con un semplice laser.

Sarebbe possibile modificare lo script mettendo come suffisso numerico il valore di soglia scelto nella maschera delle opzioni?

permetterebbe di sapere al volo quale soglia e' la migliore.

Ottimo lavoro, great job thanks

alberto IW0HJZ

  Are you sure? yes | no

oni305 wrote 04/02/2015 at 22:15 point

Thanks for the reply!
I'll edit the extension to correct the issue un the first line of the Gcode.
Yes it's possible to ad the number of the value of the b/w threshold to the
filename, but it make sense only for the fixed threshold algorithm,
because the other don't use that parameter they use random threshold (as
the name say), average (Halftone) or the exact value (grayscale).

Grazie per la risposta!
Modificherò l'estensione per correggere questo problema che mi hai segnalato!
Per aggiungere il suffisso al nome del file è possibile, però ha senso solo
se si sceglie la soglia fissa, gli altri algoritmi non usano quel
parametro, usano una soglia random (come dice il nome), la media
(Halftone) o il valore esatto (scala di grigio) .

Stefano  oni305

  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