2011-09-03

Laser Engraving and DPI Scan Gap

On laser-related forums there is often talk about engraving quality. Engraving quality depends on a lot of variables, your mechanical setup, the controller you are using, the material you are engraving on, and the time of graphic you are engraving onto that material. Most of the talk I hear is focused on the mythical DPI (dots per inch). Unfortunately, some of what is discussed is misleading, impossible to use, or just plain wrong. So today, I am taking a look at the relationship between DPI and the graphics you are engraving. And, we touch
on how the material you choose to engrave on can affect your decision about the settings you use for your job.


I heard an interesting statement the other day by Walter Lewin, physics professor at MIT.
"Any measurement you make, without any knowledge of it's uncertainty, is completely meaningless."
For example. To say it is a mile from my house to the mall is certainly a fair statement. The question is "Is it exactly a mile?" The actual distance, of course, is impossible to measure as there is always some uncertainty. But how big an uncertainty is acceptable. Well, it depends your reason for making the measurement. If I am driving to the mall, believing it is a mile when it fact it is closer to 1.25 miles is certainly close enough. But if I am jogging to the mall and back, I want to know that I am jogging about 2.5 miles instead of 2. When driving, the extra quarter mile each way doesn't mean much. When jogging, I want a little less uncertainty. Sometimes, working with our lasers, it is OK to just get it close. Other times it is important to get it a lot closer. No place is this more evident than when discussing DPI and engraving.

Vector-Based Engraving
I have seen, and I am sure you have too, tables that show the relationship the Scan Interval (or Scan Gap) necessary to achieve a certain DPI. This is useful when engraving a filled vector, for example. Using the DSP Commercial Laser Controller, scan gaps are defined by hundredths of a millimeter (.01 mm), with 10 hundredths (.10 mm) being the default value for engraving. At .10 mm scan gap, you are producing 254 scan lines per inch, an effective DPI of 254. This makes sense - most controllers are designed and manufactured in countries where the metric system is in use. But world-wide, the standard for image resolution is DPI (dots per INCH). No problem, the conversion from mm to inches is a factor or 25.4. So .10 mm = 25.4 / .1 mm = 254. Great. We know that .10 mm scan gap will give us 254 DPI.

The problem comes in when you see recommendations for certain materials. They may recommend 300 DPI, or 500 DPI. So how do you set your scan gap to get 300 or 500 DPI? Simple math will help us here. 1 (inch)  / 300 (DPI)  * 25.4 (mm/inch) = .0846666666... mm scan gap. Plug that in and you get 300 DPI.

Wait a minute! I can't put in .084666666... mm. It only accepts hundredths of a mm. So do I enter .09 or do I enter .08? One will give you 282 DPI and the other will give you 318 DPI. As it turns out, either one is probably close enough for engraving vector-based objects. Why? Because the controller is building the scan lines for you and can easily do the same math we just did. If you tell it .09 mm scan gap, it can produce that for you, scan line after scan line. So, for vector-based engraving, the following table is certainly close enough.

Notice that some gaps are covering 2 or even three different DPIs. That means or level of uncertainty is pretty large, but that is OK. Again, for vector graphics, this is normally going to be close enough.

Scanned Image Engraving
Since we have that nice table for vector-based engraving, why not just use it for scanned images, as well? After all, 300 DPI is often the default for images meant to be printed, and they look pretty darn good! The fact is because printers are usually designed with 300 DPI (or some multiple of that) in mind. 300 DPI is the default base resolution of many printers. But you may now be remembering that 254 DPI (or some multiple of it) is the default resolution of our controllers and for most of us, 1000 DPI is the default resolution of our lasers' mechanical abilities. Certainly looks like a mismatch to me.

But what if we aren't really picky? Why can't the 282 DPI or 318 DPI we get from our .09 or .08 scan gaps produce results just as nicely for scanned images as it did for vector-based engraving?

The reason is that, when scanning an image, the controller is not creating those scan lines directly, as it does with vectors. It is getting the bits that define the scan line from the image. So, if we have a scan gap of .09, for every inch of image height, the controller is going to try to extract exactly 282 lines of data. If the original image has a resolution of 300 DPI, then which 18 lines should it ignore? Conversely, if we set the gap at .08 it will request 318 lines of data. But there are only 300 available. So it has to repeat 18 lines along the way to make up the difference. So in the first case, you are loosing data. And in the second, you are repeating data. Either way, you are not going to get an output that will likely be close to the original, but with a higher degree of uncertainty (error).

The remedy, of course, is to create your original image with a resolution that matches the DPI produced by the scan gap you plan to use. The table at left is just what you need. It correlates the scan gap settings available to the DPI they produce. Just create your photos with the DPI you plan to use for engraving.

Note that in the table to the left, the .10 (default value) is highlighted in blue. We also have a couple of red values highlighted in gray. Those values are above 1000, which is the limit for a lot of lasers. Even lasers that have a mechanical resolution of 1200 can't produce the 1270 or 2540 lines per inch that these settings try to deliver to the laser.

Of course, you can't set those DPI values in most camera or scanners. So we have to rely upon our image processing software to do it for us. And it is true that our image processing software needs to make the same kind of decisions about eliminating data or creating data when converting between the images native resolution and the resolution we want. Fortunately, most photo processing software is pretty savvy at doing this; much more so than whatever is built into laser controllers. It can actually create missing data through interpolation - looking at the bits close to the bit that needs to be created and making a really good guess as to what it would be if it did exist.

Also note that it is important to let your photo processing software do the necessary conversion steps. Just as important is to have it do those steps in the correct order. Typically, you will set the image size AND DPI at the same time. The software knows how to optimize the results. If you have to do them separately, for any reason,  I typically try to set my DPI first, getting it high enough that, when the image is re-sized, there will already be plenty of bits available so no new interpolation is required.

Does Material Affect Scan Gap Choices?
It sure does! Regardless of the graphic you are engraving, the material has a lot to do with it. Any graphic will reproduce differently on wood than it does on glass, or marble, or tile. Glass, marble, and tile are all pretty smooth. Regardless of how much you sand a piece of wood, it will typically have space between the cells of the tree - we call it grain. So wood will not give you the fine detail that the other mediums will. Therefore, there is no point in using a super low scan gap (high DPI). All you will end up doing is excessive burning of the wood.  This is also why we like to use really fine grained wood, like alder, birch, and maple, instead of the more course grained woods, like oak. Just remember that you will likely be choosing different scan gaps for each material you plan to engrave the graphic on. And for photos, you will have to reprocess your original photo images for each of those materials to match the selected scan gaps.

There you have it. The quick tour of the relationship between DPI and laser engraving. Remember - vector engraving is pretty forgiving and therefore close is close enough. Photos, on the other hand, require a lot less uncertainty.
 




1 comment:

  1. Just built a 900x1200 laser with the DSP controller and this article just saved me alot of time when it comes to understanding the DPI and Scan Gap relationship. Very well written. I'll have to look around here some more.

    Ryan Brown - www.PortableSolarPower.Biz

    ReplyDelete