Units Measure

Generally when working with digital images, if it becomes necessary to work with coordinates or dimensions, pixels are used as units. However this is not always convenient. Sometimes it would be preferable to work with physical units such as inches, centimeters, etc.

Resolution and DPI

Let's assume that you need to generate a business card, which is sized at 3.5x2 inches. How many pixels will it take? How do you specify how the image should be scaled during printing? To answer these questions, images have a parameter which is called resolution - a number of pixels per some physical unit. Normally resolution is measured in DPI (dots per inch) - the amount of pixels per one inch. Generally horizontal and vertical resolutions are equal, but sometimes they may differ.

The higher the resolution, the better the quality (i.e. the more detailed the image, the less pixelization will result) but the high-resolution image is noticeably larger. As usual screen resolution is 72 or 96 DPI, scanned documents have 300 DPI. Note, printers have limited resolution (some printers cannot print more than 600 DPI, although some professional models have capacity for up to several thousand DPI). So it does not make sense to choose a resolution which cannot be reproduced by your printing device.

For instance let's use resolution 300 DPI. This means that the 3.5x2 inch image will have a width of 3.5*300 = 1050 pixels and a height of 2*300 = 600 pixels. If we had selected 96 DPI, the width would be 3.5*96 = 336 pixels and height would be 2*96 = 192 pixels.

Not only the image's size can be measured in inches (or other device-independent units). You can also measure all its coordinates and spatial parameters. All of them will depend on the resolution.

Resolution in Graphics Mill

To specify the resolution for the image (or read it from the file along with other data) use the DpiX and DpiY properties of the Bitmap class. In Graphics Mill image size and coordinates are measured in pixels, and resolution - in DPI. However if you need to convert pixels to device-independent units or vice versa, you can use a utility class UnitConverter. This class doesn't affect image data or attributes, it just converts spatial parameters to different units. For example, you can use it to calculate image size in centimeters to preview ready-to-print photos.

Measurement Units in Graphics Mill

Inches are not the only device-independent units that can be used. Graphics Mill provides the Unit enumeration for supported units:

  • Pixel. Default unit, which means that all the spatial values are measured in pixels (device dependent).
  • Point. This unit is very popular to specify font size. Point is 1/72 of an inch (so 72 points is one inch). That's why when resolution is 72 DPI, it is the same as pixels.
  • Inch. This unit was discussed above and specifies that all the spatial values are measured in inches.
  • Document. As scanned documents mainly have resolution 300 DPI, it is convenient to make a special unit which will specify one point on a scanned document. This unit can be calculated as 1/300 of an inch (in order to get resolution 300 DPI).
  • Mm (millimeter). Sometimes it is convenient to use the metric system of units instead of inches. That's why you can specify all the spatial parameters in millimeters. One millimeter is 10/254 of an inch (one inch contains 25.4 millimeters).
  • Cm (centimeter). One centimeter equals 10 millimeters or 100/254 of an inch.
  • M (meter). One meter equals 1000 millimeters or 10000/254 of an inch.
  • Pica. This equals 1/6 of an inch.
  • Column. This equals 100/263 of an inch.
  • Twip. This unit is mostly used when you need a fine way to specify coordinates or other parameters measured in units. For example the default unit in VB6 form designer are twips. It has very fine pitch - only 1/20 of a point (or 1/1440 of an inch).

See Also

Reference