UnitFromPixels Method

Create a unit from pixels and a resolution. Useful for working with images.

Namespace:  TallComponents.PDF
Assembly:  TallComponents.PDF.Kit (in TallComponents.PDF.Kit.dll) Version: 4.0.100.0
Syntax
public static Unit FromPixels(
	int pixels,
	double dpi
)
Double
Resolution in dpi (Dots Per Inch)

Return Value

Type: Unit
Remarks
Default resolution for screen display is normally 72dpi, though 96dpi is used by GDI+.
Examples
ImageShape image = new ImageShape( "image.jpg" );
image.KeepAspectRatio = true;
// Calculate width at resolution of 300dpi
image.Width = Unit.FromPixels( bitmap.Width, 300 );
See Also