Printing to Laser cutter rasterizes images
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
Alvin Penner |
Bug Description
I have an Epilog Zing Laser Cutter and when I try to print to it directly from Inkscape it rasterizes all of the lines instead of cutting thin lines. If I set the thickness of the line to 0.001" and save the file as a pdf and print from Adobe Reader it cuts as expected.
Casey Borders (thebeast-13) wrote : | #2 |
- This is a file with a 1" circle that is rasterized before sending to the laser cutter. Edit (2.1 KiB, image/svg+xml)
I am attaching a svg that contains a 1" circle with no fill and a solid black stroke that is 0.001" thick. This should cut on the laser cutter, but instead it is rasterized and etches.
su_v (suv-lp) wrote : | #3 |
- 630639-output.ps Edit (2.7 KiB, application/postscript)
When you print the SVG to file (in PostScript format, using Inkscape's print dialog), is the content of the PS file also rasterized? Maybe it's an issue with the driver not handling Inkscape's PostScript output correctly?
Printing the file to PostScript with Inkscape 0.48 on OS X 10.5.8 does not rasterize the content - the PostScript file contains only vector information.
Casey Borders (thebeast-13) wrote : | #4 |
I don't have the option in the print dialog to print to file.
Alvin Penner (apenner) wrote : | #5 |
- just writing to confirm that the print dialog no longer has an option to use postscript format. I believe this option was lost (on Windows) probably around the same time as the conversion to native Windows dialog boxes for import and export.
- you can however save as .ps using File->Save As... On Windows XP I get the attached (non-rasterized) file.
Alvin Penner (apenner) wrote : | #6 |
- Rasterized_XP.ps Edit (2.6 KiB, application/postscript)
sorry, pushed the wrong button...
- could you try printing this .ps file using some other utility like GSView, which comes free with Ghostscript. GSView has some interesting print options, like "Print to Postscript printer"
- also, as a loooong shot, on the Inkscape print dialog there is a tab called "Rendering". could you confirm that the "Vector" option is chosen on this tab?
Casey Borders (thebeast-13) wrote : | #7 |
- Rasterized.svg Edit (2.1 KiB, image/svg+xml)
Sorry it took so long to get around to testing these, but they both etch as a raster instead of cutting like a vector. Here are two more files. In Inkscape I drew a 1" circle and did save as... and saved as an svg, then I did save as... and saved as a pdf. If I try to print the svg from Inkscape it etches the circle, if I print the pdf from Adobe Reader it cuts the circle.
Casey Borders (thebeast-13) wrote : | #8 |
Jonathan Manton (jmanton) wrote : | #9 |
We have had this problem for about 8 months as well (also with an Epilog laser cutter directly attached to a machine running Windows XP). We have to save Inkscape files as PDF, then open them in Acrobat Reader before they can be sent. Thin lines are rasterized when printing.
Casey Borders (thebeast-13) wrote : | #10 |
Just wanted to write to confirm that saving as pdf and printing from Acrobat Reader is a valid workaround. It would still be really nice to be able to print directly from Inkscape.!
su_v (suv-lp) wrote : | #11 |
Setting status to 'Confirmed' based on another user report / inquiry on the mailing list:
<http://
(also described in <http://
tags: | added: win32 |
Changed in inkscape: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
summary: |
- printing rasterizes images + Printing to Laser cutter rasterizes images |
Alvin Penner (apenner) wrote : | #12 |
- print_win32_vector.py Edit (8.9 KiB, text/x-python)
attached is a proposal to produce a vector graphics printout. This particular method will work only on Windows, but if I understand the various reports correctly, this rasterization problem occurs only on Windows.
To use this method, copy the two files print_win32_
The printout will be vector graphics as long as the line width is 1 pixel or less in printer units, so in Inkscape you may need to use a line width of 0.05 pixels, roughly. For testing purposes I am using the printer driver for an 'HP Laser Jet 1200 Series PCL 5e' printer at 600 dpi. At small linewidths it produces pure HPGL as desired (which in this case is cubic Bezier splines). At larger linewidths it produces a 'rasterized' output. In the 'rasterized' output the original spline is replaced by a sequence of dozens of very short lines, similar to what one might send to a CNC machine. In addition, each curve is drawn twice, in the opposite direction, to produce an outline shape. This behavior does not occur at narrow linewidths.
Since I do not have access to a true laser cutter, any feedback would be more than welcome.
Alvin Penner (apenner) wrote : | #13 |
Adrian Johnson (ajohnson-redneon) wrote : | #14 |
I tested printing from Inkscape on windows by printing to a file (using a driver for a PS printer) and using the PDFCreator print driver. The output was all vector.
Last time I looked at Inkscape printing on windows it was using the gtk+ print API which in turn uses the cairo win32 printing surface. I suspect the problem with laser cutters is that the cairo win32 printing surface uses Geometric Pens for drawing lines (see http://
According to this article http://
The above article mentions some options for using cutters with Inkscape. Alternatively it may be possible to make the cairo win32 printing surface work with cutters by using Cosmetic Pens when the cairo user space to device space transform is a scale transform with the same scale in X and Y.
Alvin Penner (apenner) wrote : | #15 |
yes, the geometric vs cosmetic pen explanation makes sense. When I first started looking at this problem, I assumed that the problem lay somewhere in the Inkscape code. So I did three different printouts and compared them: In each case, start with a very thin cubic Bezier curve. And in each case, print to a HP Laser Jet printer driver which uses HPGL.
case 1: save svg as pdf file and print using Adobe Reader. In this case the HPGL output is recognizable as being "vector". The HPGL output contains a command called 'BZ' which stands for Bezier, and the Bezier control points are readable in the HPGL file in exactly the same format as svg uses.
case 2: print svg directly from Inkscape. In this case, rather than calling it "rasterized", it might be better to call it "discretized". The Bezier curve has been converted to a multi-line with dozens of line segments. Further, each curve is stroked twice to form an outline, and further, there is a HPGL command present called FP which stands for 'Fill Polygon'.
case 3: save svg as pdf and print from Evince. This output was identical to Inkscape output, it was "discretized".
This is the point at which I gave up, since it does not appear to be specifically an Inkscape problem.
fwiw, in gdi32.dll the distinction between the above two types of output is made in a very simple way. If you define a pen width of either 0 or 1, then you will get "vector" output, as desired. If the pen width is larger than 1, then you will get "discretized" output. Unfortunately, the problem may be that this is done in printer units, which you may not know ahead of time. This is part of the reason why I abandoned the code search and tried a different tack.
Adrian Johnson (ajohnson-redneon) wrote : | #16 |
In case 1 it looks like Adobe Reader detects that it is a very thin line and draws the line with a cosmetic pen. Cosmetic pens don't support caps and joins but if the line is 1 device unit wide this won't matter.
In case 2 and 3 it looks like when a geometric pen is used the stroke is converted to a path, flattened, then filled.
It should be possible to change the cairo win32 printing surface to perform a similar optimization as Adobe Reader. ie use a cosmetic pen if the line is 1 device unit wide and the user space transform is a uniform scale. Inkscape can use gtk_print_
Alvin Penner (apenner) wrote : | #17 |
I guess my question is: at what point is gdi32.dll called, or where is it called from (from Inkscape or from cairo or from gtk)? I assume that it is inevitable that it must be called (on Windows).
In order to use gdi32.dll the first call that is essential is a call to CreatePen and CreatePen by definition always creates a cosmetic pen.
http://
Alvin Penner (apenner) wrote : | #18 |
okay, I get it, or I think I do...
- in cairo-1.10.2
- in the file : cairo-win32-
- in the routine : _cairo_
- in line 1289 it says : pen_style = PS_GEOMETRIC;
- somewhat later there is a call to ExtCreatePen(
from the context in which this is written, I am assuming that Inkscape cannot modify this behaviour.
Alvin Penner (apenner) wrote : | #19 |
two quick comments:
1. I have confirmed that a geometric pen cannot be used to produce a vector output. As an experiment I modified the Python code above to use the call to ExtCreatePen to create a geometric pen. With a geometric pen it was not possible to produce a "Vector" output. Even at a linewidth of zero pixels, an ordinary (geometric) line was both outlined and also filled with an apparent linewidth of 1 pixel. Neither of these are acceptable, so I am going to abandon this line of enquiry which was to modify Inkscape code to do this, and concentrate instead on the Python approach.
2. A partially positive test of the Python code has been reported at Bug 966244. If I can respond to the remaining outstanding issue mentioned there, then I will post a new version there.
Alvin Penner (apenner) wrote : | #20 |
- a new version of the Python proposal has been posted in Bug 966244
- could you try this and see if it helps?
Changed in inkscape: | |
status: | Confirmed → Incomplete |
Alvin Penner (apenner) wrote : | #21 |
fix committed to bzr rev 11575,
could you test and see if it helps?
Casey Borders (thebeast-13) wrote : | #22 |
How do I test this? What is bzr?
Alvin Penner (apenner) wrote : | #23 |
you will need two files, print_win32_
http://
you will need to copy these two files into the directory \Inkscape\
I am not entirely sure if this will run as-is on your machine because it depends on which version of Inkscape you are currently running, but give it a try, and if there are error messages then report them here, together with the version number of your Inkscape.
hth,
Alvin
Kris (kris-degussem) wrote : | #24 |
Marking as fix committed by lack of user feedback.
Changed in inkscape: | |
status: | Incomplete → Fix Committed |
milestone: | none → 0.49 |
Changed in inkscape: | |
assignee: | nobody → Alvin Penner (apenner) |
Steve Morris (stevem57) wrote : | #25 |
I have the same issue running Inkscape 0.48, windows 7 and print output to a Trotec Laser. All lines are being seen as raster data.
This does not happen using exactly the same settings, colours and line weights in Corel Draw so it looks to be the Inkscape output is all raster with no vector content.
Any updates would be greatly appreciated.
Alvin Penner (apenner) wrote : | #26 |
have you tried the option Extensions-
In order to run this you will need to get a development version, available at:
https:/
Steve Morris (stevem57) wrote : | #27 |
Tried it using 0.48+devel r13487 and setting Extensions-
no change, still all raster even though the output only contains what should be cut vectors.
Alvin Penner (apenner) wrote : | #28 |
did you specify a narrow linewidth? Just repeating some details from comment 12 above:
>> The printout will be vector graphics as long as the line width is 1 pixel or less in printer units, so in Inkscape you may need to use a line width of 0.05 pixels, depending on your printer resolution, remembering that Inkscape resolution is 90 dpi
Jörg Eichhorn (jeichhor) wrote : | #29 |
hi alvin, thanks for your work.
same here. created black rectangle, with no filling and linewidth set to 0.5px
problem: the rectangle gets rasterized.
testsetup:
win7 64bit, Inkscape 0.91pre2 r13516
install epilog zing driver 9.0.1
https:/
setup as network driver.
when printing redirect to file.
when selecting option to print "only vectors" the print-file is almost empty
%1BIN;
where a working print-file (generated using illustrator) contains coordinates
%1BIN;
Can't use the "Export/
Could you please check, if there is a regression? afair an older dev version worked for me, but can't reproduce.
The possibility to use inkscape for lasercutting would be a great opportunity for our fablab.
Thanks a lot.
Alvin Penner (apenner) wrote : | #30 |
just two comments:
>>same here. created black rectangle, with no filling and linewidth set to 0.5px
It is highly unlikely that this stroke width will work. As stated above, the stroke width must be 1 pixel or less in printer units, not Inkscape units. Inkscape resolution is 90 dpi. This means that if your printer resolution is 1200 dpi, which is fairly typical, then you will need to specify a stroke width, in Inkscape, of about 90/1200 = 0.075 px.
second comment, the option for Win32 Vector Print is not part of the normal priunt operation which is File->Print. It is part of the Python extensions system, obtained on the menu at Extensions-
Jörg Eichhorn (jeichhor) wrote : | #31 |
sorry, i mussunderstood the px-setting.
now i've tried again with the minimum stroke width of 0,001mm - still no vector output, also tried the "usual" hairline value of 0,01mm - still the same
yes, the export->win32 vector print exists. but no, the printer is actually not connected.
Alvin Penner (apenner) wrote : | #32 |
could you attach the svg file you are using. I will try it on my machine to see if it works.
Jörg Eichhorn (jeichhor) wrote : | #33 |
Alvin Penner (apenner) wrote : | #34 |
- rect_004.prn Edit (918 bytes, text/plain)
thanks for the file. I printed this to an output file using the printer driver for an HP Laserjet 1200 running at 300 dpi. The output is attached here. It is hpgl vector graphics as can be seen from the commands which it contains:
SC - scale
PU - pen up
BZ - Bezier Absolute
Alvin Penner (apenner) wrote : | #35 |
- rect_1.prn Edit (1.4 KiB, text/plain)
Just for comparison purposes attached is the output I obtain when I change the stroke width to be 1 px in Inkscape. The file is larger and it does not contain vector commands in it. Instead it contains the command PE (polyline encoded) which indicates that the output will be rasterized.
Jörg Eichhorn (jeichhor) wrote : | #36 |
- rect_zing_combined.prn Edit (13.1 KiB, application/octet-stream)
attached the prn file using the zing driver, allowing raster+vector elements in the printer settings.
set resolution to 250dpi in printer settings - but thought the resolution in this driver is not be related to the vector part.
Alvin Penner (apenner) wrote : | #37 |
yes, well, that definitely looks rasterized, I do not see any vector elements there. Unfortunately, I do not have access to the zing driver, do you know if it is available for free somewhere?
alternatively, do you have any sample output of the zing driver, where you know for sure that the output has some vector components?
Alvin Penner (apenner) wrote : | #38 |
did one final test, with an Epilog driver. I downloaded an Epilog driver, Epilog Zing driver 9.01, for the device Epilog Engraver Zing. I ran it with the default settings, namely 500 dpi and Combined Job Type. The output I get is attached here. It appears to be pure vector hpgl as expected.
Alvin Penner (apenner) wrote : | #39 |
Jörg Eichhorn (jeichhor) wrote : | #40 |
your zing_combined.prn looks like gold - thanks for your effort.
could you please attach your svg?
this makes it hard.
which os are you using? are there external libraries used by inkscape? any settings in windows to check?
is there any debug output i could enable?
Alvin Penner (apenner) wrote : | #41 |
I was using your file rect_elip.svg from comment 33.
OS is Windows XP, Inkscape rev 13549.
Have you been using the Python procedure Extensions-
If so, that's all you need. I would double-check the printer driver settings, or try a different driver as a test.
Jörg Eichhorn (jeichhor) wrote : | #42 |
Hi Alvin,
I confirm Export->"Win32 Vector Print" is working using Win7 64bit, inkscape r13516. setting linewidth to "0,001mm"
I've managed to capture a print file by changing the "Printer Port" to "File:".
Again, many thanks for your help
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
Steve Morris (stevem57) wrote : | #43 |
Is this fix included in release 0.91 for 32 bit windows?
Alvin Penner (apenner) wrote : | #44 |
yes, it is on the menu item Extensions-
J Matthew Gaskill (jmgaskill) wrote : | #45 |
...working w/ Inkscape r13725 to drive Universal PLS6.60 Laser Cutter; as stated previously file->print does not create vectors which precludes "cutting" however file->print does generate the raster necessary to "engrave"
using Extensions-
Ideally both vector and raster will coexist to drive both cutting and engraving from a single output. As a work around I can use file->print to create the raster image and perform the engraving operations on the laser then generate a separate vector only output to cut the parts.
can a solution be developed that combines the file->print raster with the Win32 Vector Print -- it would also be nice if this solution would also temporarily (or internally) resize the strokes to ensure vector output. Appropriately sized strokes (0.01mm) are difficult to see on screen while working in Inkscape so it is convenient to set these to 1px for editing.
...drivers for the laser cutter can be downloaded here and work well for testing even if you don't have a laser system connected: http://
Alvin Penner (apenner) wrote : | #46 |
>>> can a solution be developed that combines the file->print raster with the Win32 Vector Print
just offhand, I can not see any easy way of doing this. The File->Print routine is written in C, while the Win32 Vector Print is written in Python, so they cannot easily be integrated. Also, the Win32 Vector Print is a Windows-specific solution that will not work on any other platform. (If I understand the situation correctly, it is not actually needed on other platforms.)
>>> it would also be nice if this solution would also temporarily (or internally) resize the strokes to ensure vector output
In this case the answer is a bit more optimistic. The Win32 routine was written in such a way that the Inkscape user could choose the stroke width appropriately for each individual object so as to get either raster or vector output (of the stroke only), depending on what you want for each object. If you had decided that you wanted everything to be written as vector, then you could modify the Python script to force everything to be done as vector output, regardless of the Inkscape stroke width. For example, go to line 67 of the file print_win32_
J Matthew Gaskill (jmgaskill) wrote : | #47 |
...thanks Alvin; great help -- while new to python I do have a bit of programming experience so I followed your suggestion and took a stab at it.
The crux of the problem with using Inkscape to generate files for ULS Laser Cutters is the lack of a "hairline" stroke designation (stroke-width=0 but still visible when rendered). Looking through the options natively available within Inkscape it seems that designating a stroke of "1 pt" more or less captures the intent (at least until "hairline" or " non-scaling-stroke" is implemented per SVG 1.2). We typically use units of "in" or "mm" to create geometry for the laser which leaves "pt" essentially untapped (as long as an equivalent dimension in a another unit not used).
Setting "vector" strokes to width=1 pt and adding the following lines to print_win32_
if style['
stroke = 1
The next issue is the requirement to use the default printer; one would assume there must be a way to create a printer dialog of some sort then allow the user to select the printer she would like to use; perhaps along with the assistance of these resources:
https:/
https:/
http://
Henry (hkroker) wrote : | #48 |
Thanks for a GREAT discussion regarding this topic and humble apologies for posting to an old thread.
Oddly I find myself travelling through the same valley of death years and versions after the end of this thread.
I have learned how to output vector to my VLS200 using the export method using the win 32 vector export.
I can also use the print function to output raster via the same VL200 Advanced driver. Both cases assuming that the VL200 Advanced printer driver is default.
I cannot seem to be able to output both with either method. Take the example of a box with a letter in it. Using the export technique I am able to print the vector box but not the letter. I use the print method and output the letter but not the box. My concern is alignment and scaling. On a simple object like this I can manage but on larger pages - say a label run I have problems.
I noticed that Mr Gaskill in post 45 asked the same question I need to ask. Am I doing something wrong when I try to output vector to the driver through the print mechanism? My stroke is set to 0.075px and the version I am using is Inkscape 0.92.2 (5c3e80d, 2017-08-06) Is there solution to do both?
Alvin Penner (apenner) wrote : | #49 |
something you could try is to select all the text and perform Path->Object to Path, so everything is a path. Then use the vector print extension.
Rick-firefang (rick-firefang) wrote : | #50 |
I've submitted a patch to win32 Cairo so that it properly sends anything smaller than the device's smallest unit size as a hairline (0.001" works) so you can print directly to laser printers now: https:/
Of course, these lines are hard to see, so I've also created a patch in Inkscape for a new display mode that makes "hairlines" (anything smaller than half a pixel on screen) more visible: https:/
Shane Madie (shanemadie) wrote : | #51 |
- $10 For Left Chest.jpg Edit (54.7 KiB, image/jpeg)
Thank you so much, for such an amazing blog. I enjoyed every single part of it. I was looking for <a href="https:/
shahaib (shahzaibk) wrote : | #52 |
Our embroidery designs are created using various computer programs. They are then transferred to the embroidery sewing machine. We have the capability of enlarging and shrinking the design - making it possible to use the same pattern on several items of different sizes, such as on towels and washcloth sets. For more information, please visit the URL at https:/
Do you have reduced opacity or transparency set for the object/stroke style? Can you attach a sample SVG file that prints rasterized?