ImageEn, unit imageenview

# TImageEnView.ScaleX

### TImageEnView.ScaleX

#### Declaration

property ScaleX: double;

#### Description

Specifies the horizontal scale factor.

In the common representation A:B (e.g. 1:100000), where A is the size in the image/model, and B the size in the real world. ScaleX is the B value (100000).
This value and IO.Params.DpiX determine the displayed values when measuring distances and areas (miMeasureLength, miMeasureRect or miMeasureEllipse in MouseInteractGeneral) and displaying the ruler (ShowRulers).
For example, DPI of 100 and Scale of 1 is the same as DPI of 200 at scale of 2, or DPI of 1000 at scale of 0.1.

Default: 1

#### Measurement and Scaling

Say you have an image that is 100 DPI (dots per inch), so that when it is printed every 100 pixels print out at a size of 1 inch (2.54cm). If TImageEnView.ScaleY/Y=1, using the measurement tool, a length of 100 pixels will naturally display as 1 inch/2.54cm. But what if we have a photograph of an object where 1 inch in the image represents 1 foot (12 inches) in the real world? This would equate to a scale of 1:12, i.e. TImageEnView.ScaleY/Y = 12. Now, when you select 100 pixels, the measurement tool will report 1 foot.
Naturally it will also work the other way. If we have a detailed image that is recorded as 100 DPI (i.e. 100 pixels = 1 inch/25.4 mm), but actually 100 pixels represents 2.5mm, the scale would be 1:0.1, i.e. TImageEnView.ScaleY/Y=0.1 (alternatively, you could set the DPI as 1000).

To make it easier, you can use TimageEnView.SetScale. In the first example we would use:

ImageEnView1.SetScale(100, 1, ieuFeet );

And in the second:

ImageEnView1.SetScale(100, 2.5, ieuMillimeters );

#### Example

// Set a scale factor so that one inch in the photo measures as one mile (i.e. 1:63360)
ImageEnView1.ScaleX := 63360;
ImageEnView1.ScaleY := 63360;

// Set a scale factor so that one cm in the photo measures as one meter (i.e. 1:100)
ImageEnView1.ScaleX := 100;
ImageEnView1.ScaleY := 100;

// Set a scale factor so that one cm in the photo measures as one micron (i.e. 1:1/10000)
ImageEnView1.ScaleX := 0.0001;
ImageEnView1.ScaleY := 0.0001;