ImageEn, unit iexBitmaps

TIOParams.Dpi

TIOParams.Dpi


Declaration

property Dpi: Integer;


Description

Specifies the resolution (dots per inch) of the acquired image. If the horizontal and vertical resolutions aren't equal, Dpi is the horizontal resolution (the same as DpiX).


Calculating DPI

The formulas for DPI are as follows:

dpiX := widthPixels div widthInches;
dpiY := heightPixels div heightInches;

widthPixels := widthInches * dpiX ;
heightPixels := heightInches * dpiY;

widthInches := widthPixels div dpiX ;
heightInches := heightPixels div dpiY;


Examples

// Show the dimensions of the current image in inches (assumes DpiX and DpiY are the same)
lblDims.Caption := IntToStr( Trunc( ImageEnView1.IO.Params.Width / ImageEnView1.IO.Params.Dpi )) + ' x ' +
                   IntToStr( Trunc( ImageEnView1.IO.Params.Height / ImageEnView1.IO.Params.Dpi )) + ' inches';

// Show the dimensions of the current image in mm (assumes DpiX and DpiY are the same)
lblWidth.Caption := IntToStr( Trunc( ImageEnView1.IO.Params.Width / ImageEnView1.IO.Params.Dpi * 25.4 )) + ' x ' +
                    IntToStr( Trunc( ImageEnView1.IO.Params.Height / ImageEnView1.IO.Params.Dpi * 25.4 )) + ' mm';

// Enable measuring of lengths in image (Imperial)
// Set scale of 250 pixels = one inch
ImageEnView1.SetScale( 250, 1, ieuInches );
IEGlobalSettings().DefaultMeasureUnit := ieuInches;
ImageEnView1.Update();
ImageEnView1.MouseInteractGeneral := [ miMeasureLength ];

// Enable measuring of lengths in image (Metric)
// Set 100 pixels = 4cm
ImageEnView1.SetScale( 100, 4, ieuCentimeters );
IEGlobalSettings().DefaultMeasureUnit := ieuCentimeters;
ImageEnView1.Update();
ImageEnView1.MouseInteractGeneral := [ miMeasureLength ];

// Set image dimensions to 8.5 x 11.7"
ImageEnView1.IO.Params.DpiX := Round( ImageEnView1.IO.Params.Width / 8.5 );
ImageEnView1.IO.Params.DpiY := Round( ImageEnView1.IO.Params.Height / 11.7 );


See Also

 DpiX
 DpiY
 ScaleX
 ScaleY
 SetScale
 ChangeResolution