Convert Size from CMs to Pixels

Navigation:  »No topics above this level«

Convert Size from CMs to Pixels

Previous pageReturn to chapter overviewNext page

Internally our Aztec Win32 DLL converts the module size width from centimeters to pixels based on the device resolution, round up or round down float pixel value to the nearest integer.

 

The centimeter to pixel conversion formula is :

size_in_pixels = size_in_centimeters * device_resolution / 2.54

 

For example, if you render the Aztec barcode onto the computer screen and the screen resolution is 96dpi.

 

(1) Set ModuleSize parameter to 0.04,  size_in_pixels = 0.04 * 96 / 2.54 = 1.5118, round up 1.5118 to 2, so actual  module sizewidth is 2 pixels.

 

(2) Set ModuleSize parameter to 0.06,  size_in_pixels = 0.06 * 96 / 2.54 = 2.2677, round down 2.2677 to 2, so actual module size width is 2 pixels.

 

(3) Set ModuleSize parameter to 0.07,  size_in_pixels = 0.07 * 96 / 2.54 = 2.6456, round up 2.6456 to 3, so actual  module size is 3 pixels.

 

Different ModuleSize parameter values might end up with same module size width in pixels due to performing rounding operations.