By defining a performance metric in terms of a model of the human visual system, we can develop a criterion for the accuracy of a halftoning algorithm. Directly optimizing this criterion leads to an algorithm based on the Gibbs sampler. The resulting algorithm is more computationally expensive than error diffusion: however, it is local, highly parallel, and has a number of other desirable properties. For high quality halftoning, it is necessary to take into account the physical characteristics of the display device. The proposed algorithm can do this in a direct manner. For black and white monitors, this leads to an adjustment in the calculated brightness of the first pixel turned on in raster order; this brightness adjustment is significant, as the first pixel in such a run has been measured at only 70% of the brightness of succeeding pixels. In printed halftoned images, ink overlap leads to a decrease in the perceived darkness of adjacent dark pixels; again, the difference is significant, having been measured at 16% effective overlap. On color patterns, it is possible to directly measure the colors produced by the printer and use them in formulating the error measure for halftoning. Adjusting for these effects, which cannot be done with error diffusion algorithms, leads to perceivable increase in halftoned image quality.