[Home]MoonShadow/PrintingFAQ

ec2-3-81-28-94.compute-1.amazonaws.com | ToothyWiki | MoonShadow | RecentChanges | Login | Webcomic

"Ok, I've drawn some stuff, scanned it in, laid it out, now I'm coming to print it. I've just got proofs back / tried printing it out myself, but I'm getting blotchy lines, patchy greys, what appears to be extremely poor resolution on the nice 600dpi printer, and weird patterns ("moire") in areas where I've used screen tone. Help!"




This is what I currently think I know on the subject. Some of it may be wrong, but it seems to work.

Laser printers don't print greys. They print little black dots. If you alternate black dots with white spaces, your eye will merge that into a grey. Dithering is the process of taking an image and coming up with appropriate patterns of dots in the colours that the device can actually print ( and sometimes taking other constraints into account) such that you will perceive something that looks vaguely like the original. You really really really want to control the dithering process yourself.

Here's why.

Most cheap printing houses, when given a greyscale image, will halftone or use a clustering dither with very low LPI. What this means in nontechnical terms is that they will map your image onto a pattern of blobs, and vary the size of the blobs to simulate levels of grey. Look at the examples on [this] page. This works well with low resolution images, since the round blobs help hide the underlying blockiness. It works less well with the high-res line art most digital artists work with these days. The problem is that the blobs are in a fixed pattern which is usually relatively low resolution - you get relatively few blobs per inch. Your image ends up looking blotchy, fine detail is lost and antialiased lines look worse than ones that haven't been. (Antialiasing is the process of turning a jagged black-and-white edge into a less-jagged-looking edge by working out how much of each pixel the edge covers and turning it into the appropriate shade of grey. This works wonderfully on devices that can actually display real greys, but if you consider the above explanation of halftoning for a moment you will realise that it can have the unfortunate effect of scattering large black blobs away from the line edge on devices that can't).

Modern laser printers typically can't vary the size of the dots, but they can print lots of them - commonly, 600 to the inch. Using that capability to emulate halftone, clusters or print other low-resolution fixed patterns seems blatantly wasteful. One alternative is to use an error-diffusion dither like FloydSteinberg? or one of the SpaceFillingCurve? dithers. (Other alternatives are mentioned below). Basically what these do is: for each pixel, if it's darker than 50% grey make it black, otherwise make it white. Work out the amount of error - how different that pixel was to the colour you made it - and distribute that between nearby pixels that you haven't dithered yet. This approach is better at preserving detail than halftoning, and is easier on the eye if antialiasing was used in the original; in particular, if the resolution of the original greyscale image is less than 600 dpi - which, for A4 images scanned in at 300dpi and printed on A5, the most common scenario, it will be (think about it - only one dimension is halved when you go from A4 to A5) - antialiased lines and text look better than non-antialised lines and text if an error diffusion dither is used, but worse if halftoning, or a cluster or other patterned dither is used (again, think about it - halftoning pattern resolution is usually much lower than that of your original image, so you're scattering blobs of black relatively far from the lines, but since your image is lower resolution than the printer can print, you can get rid of some jaggedness by scattering dots of black a little way from the lines, which is what error diffusion is for).

Ok, so supposing we're gonna go with error diffusion.

Unfortunately, printing houses at the cheap end won't know what you're on about if you ask them whether they have any control over how their devices treat greyscale images. So you need to take over and do it yourself. If you hand the device a black and white image at its native resolution, it  can happily go and print it - it won't need to resize, halftone or otherwise muck about with it.

The key thing is the "native resolution" part. Resolution isn't just "number of dots". It's "number of dots per unit of distance" - e.g. "dots per inch". In other words, you need to know how wide and high the device will make your image in a real-life measurement of distance, like inches; multiply that by the number of dots the device prints per inch; make your image that high and that wide; then dither it.

Unfortunately, if you give the printing house a bunch of JPEG, PNG, TIFF or whatever images, you can't generally know how wide they'll decide to make them, unless you pay them lots of mucking-about charges; which one assumes you don't want. If one pixel of the dithered image does not map to one pixel of the device, you will get a [moire pattern]. You need to take absolute control of the image size on the page.

The best way of doing this that I've found so far is LaTeX?. You use a simple LaTeX? script to pull in the image and tell LaTeX? it is whatever width you decided on in inches, millimetres or whatever; you can also specify its position on the page, if it's smaller than the entire page. When you later use the LaTeX? interpreter to make the script into a PDF, the interpreter typically doesn't touch your image; it embeds it verbatim in the PDF, along with code (PDF is TuringComplete, AIUI) to decode it at the other end and something to tell the device how wide to make it. That's it - you've guaranteed the width of your image. Knowing that width, you scale your greyscale image until it is that wide; changing the height appropriately, to preserve the aspect ratio. If you started with an A4-sized image, this is enough. If you plucked a height out of thin air when you made your image, you'll probably need to tweak the LaTeX? so it is centered vertically, assuming that's what you want. Then you dither. Now you invoke the LaTeX? interpreter. Voila - you've got a PDF that you can hand to the printers for the perfect result.

So, to summarise:

For bonus points, you can make the PDF file A4-size, bunch up two A5 sheets per A4 side, make it two-sided and order the images in such a way that all the printing house has to do is shove the PDF through their double-sided printer, staple the result in the middle and hand it to you. Get yourself some paper, make it into a booklet with the same pagecount as what you're gonna send, number the pages, then pull it apart and work out what's adjacent to what and in what order (it ain't obvious).




Geeky Stuff (tm)



Sample LaTeX? (assuming double-sided A4, one image per side):

\documentclass[a4paper,landscape,twoside]{minimal}
\usepackage{geometry}
\geometry{top=0cm,bottom=0cm,left=0cm,right=0cm,nohead,nofoot}
\usepackage{graphicx}
\usepackage{calc}
\begin{document}
\thispagestyle{empty}
\centering
% ---- insert images here

\includegraphics[width=29.7cm]{1.png}
\newpage
\includegraphics[width=29.7cm]{2.png}
\newpage
\includegraphics[width=29.7cm]{3.png}
\newpage
\includegraphics[width=29.7cm]{4.png}
\newpage

% ---- pages finish here
\end{document}


Note landscape A4 is 29.7cm across - so your images would need to be 7015 pixels across if the printer is doing 600dpi (0.3937 inches to the cm). You'll probably want to leave 5-6mm margins around the edge of your image - work out what that is in pixels in the same way and make yourself a template by drawing lines that far in from the edges and middle of a 7015 x (height of A4 in pixels at 600dpi) canvas. There's a perl script to generate templates given a paper size and margin in millimetres [here] - it produces [netpbm] images on standard output (IrfanView?, PaintShopPro, PhotoShop? etc can all read them, and you can use the netpbm tools to convert them to other formats anyway). As given, it will produce an image with lines 5 and 6mm away from the edges of A5 booklet pages on a single side of an A4 sheet.

[This] is the evil hacky Perl script I use to produce PDF files for LookingForTheSun. SunKitten makes a bunch of images laid out according to the above template, one per side of A4, but at whatever resolution she ends up working in (she scales the template). She invokes the script, listing all the images on the command line in order. The script then goes away, resizes the images as described above, dithers them, makes a LaTeX? file and invokes LaTeX? to produce a PDF.

I don't know if this script will work for you. At the very least, you'll need Perl, LaTeX?, GhostScript? and netpbm installed to use it. Those may depend on other things I'm not aware of. *shrug* With any luck, I've given you all the info you need to do all the operations by hand anyway - all the script does is automate it and save you doing the math to work out how big the images should be.


I'm not sure about laser printers only being able to do dots of one size. Most HPs have "Resolution Enhancement Technology" which is something to do with being able to increase the apparent resolution, probably when dealing with greys. - Bobacus
I've seen the settings for that, but can't find any solid info on what it actually does. Will dig deeper. - MoonShadow

Also, IIRC the way the charge and toner are applied means that dots will tend to glob together, making halftoning better than error diffusion at the printer's resolution. --Bobacus
That's what many of the websites say, but it has not been our experiences - halftoning has invariably given much worse results from digital printing companies than error diffusion. It's probably only true for the low end, or something. Our own Laserjet 4 is so cr*p either way that I honestly can't tell which is worse. I'll stick some scans of what we get from the printing companies up when I next get a chance and you can judge for yourself. Note also that the laser printers in Cockcroft will error-diffuse rather than halftone by default. Oh, and "at the printer's resolution" is a key part here - as opposed to 72 lines per inch, which is what some commercial digital printing houses will give you by default. - MoonShadow
Ah yes. Printing. There's a lot of cans of worms available - plenty to go round. You may find (partially because of what Bobacus said) that your greyscales are more faithfully reproduced when using clustered halftoning, because the individual dots may be larger than the grid in which they fit. Back in the days of dot-matrix printers (where this is a particular problem), quite a lot of attention was paid to this. The idea of clustered halftoning is to reduce the inaccuracy caused by the dot-splurge, by making such splurges overlap with other printed dots. You can see the effect if you create a black to white smooth gradient, and print it out using the different dithering methods. You will probably see quite a bit of brightness distortion in the error-diffusion dithering pattern --Admiral
Also, it isn't merely a choice between error diffusion and "how big is the dot". A third option exists, whereby you maintain the resolution of the original image. This image illustrates what I mean - the left edge is using standard clustered halftoning, while the right edge maintains the resolution of the diagonal. --Admiral
Image: 140
Oh, the other thing is that most of this research seems to have been forgotten by a lot of "professional" printing shops. --Admiral
Hm. Theoretically, my target audience on this page is noncompscis who do small print runs of amateur comics. The primary purpose of the initial rant is to convince them to do something other than just hand a bunch of greyscale images to someone like http://printout.co.uk and hope something sane comes back (it doesn't; they complain, switch to another digital printing company, have the same problems, rinse, lather, repeat). Their image manipulation software will have clearly marked ways of producing an error-diffusion dither, so it makes sense to suggest that. The output equipment is actually surprisingly well defined: all the cheap end - and it's gotta be cheap, not professional, we're talking very skint, if very dedicated, people here - printing companies in Cambs seem to have black and white digital printing equipment with very similar capabilities. It'd be useful to list other options, though. Some people even like halftone as an artistic effect but want to maintain the resolution of the original, for instance. Admiral, do you have any software you can recommend for an artist using Windows to produce results like that sample image? - MoonShadow
Yes. Gcc. Inputting/outputting netpbm images is so trivial that knocking up a small C program to do it would be a small exercise. You could use perl if you want. I don't know of any graphics packages that do it all for you, but then I haven't looked very hard. --Admiral
OK, well, I guess that works for you and me and if an artist wants one they can ask here and we'll send them one ;) - MoonShadow
Clustered halftoning looks best on printers with a high resolution (like 1200 dpi or better), like the printers used for magazines, because then the dots are sufficiently small. (Of course, for billboard advertisements, having dots a centimetre across counts as "high resolution".) For printers with lower resolution, an alternative is to use error distribution, but with some complicated algorithm that works out how much the dots overlap and compensates. A simple gamma correction will approximate this effect. Another possibility is to use a small clustered halftone grid, but add error distribution to allow more shades of grey to be shown than the number of dots in the grid. --Admiral

Not sure this helps, but generally I use PaintShopPro and choose the middle option for the error diffusion type.  This seems to give the best balance between preserving lines and avoiding dotty moire.  --Vitenka

ec2-3-81-28-94.compute-1.amazonaws.com | ToothyWiki | MoonShadow | RecentChanges | Login | Webcomic
Edit this page | View other revisions | Recently used referrers
Last edited September 10, 2004 10:29 am (viewing revision 21, which is the newest) (diff)
Search: