Graphic scaling improvements, submitted by Paul Grosso


DITA's support for graphic sizing--which just allows a number of pixels to be specified for the graphic image size via the image element's height and width attributes--does not meet our customer requirements. I suggest we make some upward compatible changes to address at least a subset of these requirements.


Current situation

The DITA spec is vague on the topic of what are valid values for the image element's height and width attributes and what are the semantics of these values.

In checking both the toolkit and the collective IBM knowledge, I understand that, for HTML generation, the image height and width values are passed through as-is implying that DITA's image's height and width attributes must be unitless integers giving the number of pixels to which to scale the graphic image (in each direction) in the browser displayed results. For IBM PDF processing, the pixel values are converted to points (assuming 96 pixels per inch and 72 points per inch), and that value is used.

Requirements for graphic scaling

  1. It should be possible for users to specify a percentage value to which to scale the intrinsic size of the image.
  2. It should be possible for users to specify an absolute size for the image height and/or width using a numeric value and unit of measure. Allowable units should include: pc (pica), pt (point), px (pixels), in (inches), cm (centimeters), mm (millimeters), and em (ems) as allowed by CSS and XSL-FO.
  3. To aid in reuse and minimize hardwiring style to the source, it may be a requirement to allow a user to request that an image be scaled to some percentage of the "available space".

One specific proposal

  1. Add the "scale" attribute to the "image" element, and change the declared type of the scale attribute to NMTOKEN. Define the allowable value space of the scale attribute to be any unsigned integer. This would be an upward compatible change.
  2. No change needs to be made to the image element's height and width DTD declarations, as NMTOKEN would allow all values we wish to allow. We would just augment the spec to say that the value space of these attributes is a length which is a real number with an optional unit from the set of pc, pt, px, in, cm, mm, em. An omitted unit implies pixels so that existing documents will continue to be treated the same way.
    • Added March 7: remove the word "Maximum" from the description of image height and width. Advise Michael of additional documentation improvements.
  3. Removed from proposal by Paul Grosso ( This requirement could be met by allowing image element's height and width attributes to take % values along with some work to define what the "available space" is. The specific details of a suggested solution depend on the exact user requirements which I'm still researching (and would appreciate input from other users).

Graphic_scaling_improvements (last edited 2009-08-12 18:02:48 by localhost)