On Sunday, 4 June 2023 15:15:09 BST G. Branden Robinson wrote: > Hi Doug, > > At 2023-06-04T06:59:55-0400, Douglas McIlroy wrote: > > >> Does anyone have a recipe for including a bitmap image in a groff > > >> document? I wish to assure that on a raster-printing device the > > >> bitmap is appropriately aligned with that of the device. > > > > > > There is a PSPIC macro which is part of the MM macros (groff_mm) > > > which I use to pull in a picture. > > > > I use PSPIC regularly. It is capable of scaling images, but this is > > not the same as aligning bitmaps. I would like to assure that a > > 1000x1000 bitmap, say, occupies exactly 1000x1000 pixels on the > > display, regardless of the physical size of a pixel. A misaligned > > bitmap produces unwanted artifacts such as. Moiré patterns. > > > > Of course, on a very high resolution device 1000x1000 pixels may be an > > extreme eye test, but I can deal with that if necessary. > > There doesn't appear to be a troff drawing command for this purpose, and > no groff device control command tag for it, either. Maybe it would be a > nice thing to have.
The problem is that you have insufficient control over the viewer which displays your document. Certainly you can embed a 1000x1000 image into a postscript or pdf file which will contain exactly that number of data points, but it also has a physical size in proportion to the actual media size. So if your picture occupies a quarter of the page when you view it in a viewer, the actual number of screen pixels used for the picture will depend on many variables over which you have no control, screen dpi, viewer zoom level, size of viewer window on the screen. So the short answer is that I don't think it can be done. If possible it is better to use vector graphics if at all possible for diagrams or figures in a document. Cheers Deri