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).

The DPI is set when loading images. Otherwise it defaults to:
https://www.imageen.com/help/TIEGlobalSettings.DefaultDpiX.html
https://www.imageen.com/help/TIEGlobalSettings.DefaultDpiY.html


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 );

// Show image zoom based on its DPI
// Note: More accurately you should get the PPI for the display monitor (e.g. Form.CurrentPPI)
Caption := IntToStr( Round( ImageEnView1.Zoom / ImageEnView1.IO.Params.Dpi * Screen.PixelsPerInch )) + '%';

// Display image at 100% based on its DPI
// Note: More accurately you should get the PPI for the display monitor (e.g. Form.CurrentPPI)
ImageEnView1.Zoom := ImageEnView1.IO.Params.Dpi / Screen.PixelsPerInch * 100;


See Also

DpiX
DpiY
ScaleX
ScaleY
SetScale
ChangeResolution