Home Forums General XMetaL Discussion How to set consistent image DPI Reply To: How to set consistent image DPI

Derek Read

Reply to: How to set consistent image DPI

I think this question really needs to be framed within a particular output format. As most people concerned with image quality etc are going to PDF I might assume that here. I also assume we are talking about bitmaps as well (such as JPG, GIF, TIF…)

One Suggestion:

1. Figure out the best (or lowest) quality of image you are willing to embed in the PDF and standardize on that (the DPI for this will be dictated to the people that make your images). The higher the quality (the more pixels it contains) the larger the file size, which translates directly into making your PDFs bigger. Assuming you do not need to allow readers of the PDF to zoom in and see more detail the ideal size would be 1:1, though this does get tricky because there is not really a 1:1 correspondence between bitmaps and what appears in the PDF which is typically translated to real-world units using various conversions (there are settings in PDF viewers that let people override these things). When viewed on a screen, an image created for viewing in Windows (typically at 96 DPI) will appear different on a Mac (typically 72 DPI) AND if the reader has altered the settings in their PDF viewer. In Acrobat 8 look in Preferences for Page Display > Resolution > Use System Setting (value obtained from the OS) or Custom Setting (you can set any value you like here to mess with things). If I could spare the room (making the PDF larger) I would probably recommend images of 150 DPI and then scale them down to fit the area I need on the page, (perhaps by roughly 75% so they roughly match 96 DPI for most readers). This will allow people to zoom in to see details (if necessary) and will also give a reasonable print output in many cases if people do decide to print a physical copy.

2. If you wish to avoid the use of the scale attribute (which is not really supported by the DITA OT yet anyway, regardless of whether you are using DITA 1.0 or 1.1) set only one of the dimensions of the image. Both XMetaL Author Enterprise and the DITA OT currently support setting both width and height or one of either. If you set only one the other one will automatically size using the correct aspect ratio. This follows the rules laid out in the DITA Language Reference. XMetaL Author Enterprise itself handles width, height and scale properly, along with the various allowed units. The limiting factor here at the present time is the DITA OT.

Scaling and Units:

If you know the maximum width for your PDF content (within margins) is 6.5 inches (for example) then use “6.5in” as the maximum width for your images. This is the one main reason I can think of to scale down if necessary (when an image is too big to fit within the area it is contained inside in a PDF it will not be visible). Or if you prefer to deal with centimeters or millimeters (perhaps you are using A4 or other European paper sizes) then use those units instead (cm and mm).

If you do not wish to change the size of the images at all but instead leave your images at “100%” then simply specify nothing for scale, height or width. In this case both XMetaL Author Enterprise and the DITA OT will honour that and figure out how big an image should be (translation is done by RenderX using 120 DPI default but this may also be 96 or other depending on the output customization). Again, this follows the rules laid out in the DITA Language Reference.

All of this may vary for other output types. It will also vary if you are using a modified copy of the DITA OT.

Conditions (aka: Conditional Text):
Another slightly more complicated option would be to create two or more images at different resolutions and use conditions to specify which one will be included when generating a particular output. This would allow you to create a “high resolution PDF” (containing images at high resolution but scaled down) and a “regular” or “low” resolution PDF (containing images at lower res). Conditions may also be useful when using the same content to generate HTML or other output formats where you wish to use quite different settings with regard to images.