Set Barcode Size and Resolution in Python via .NET

This article describes how to manage settings provided by Aspose.BarCode for Python via .NET to adjust barcode measurement units (millimeters, inches, points, or pixels) and barcode image resolution.

Overview

Cartesian coordinate systems use coordinates of pixels or drawable objects to represent image data for raster or vector images. To link these coordinates to real-world measurement units, such as millimeters or inches, Aspose.BarCode for Python via .NET includes a special class called Unit and its properties called resolution that is intended to manage barcode resolution measured in dots per inch (dpi). Class Unit provides various properties that serve to convert barcode size values defined in pixels, millimeters, inches, or points to any of the supported measurement units automatically. In this way, the size of elements in real-world measurement units can be converted into pixels to generate barcode images.

Measuring Barcode Size in Various Units

Class Unit allows developers to manage measurement units for barcode parameters and can be modified using the properties of class BarcodeParameters, such as bar_code_height, bar_code_width, and x_dimension. Class Unit can be used to convert measurement units into the desired ones: millimeters, pixels, inches, point (1/72 inch), or document (1/300 inch). By default, millimeters are used as size measurement units.

Barcode labels created using various unit settings are shown below.

Size Units pixels millimeters

Image Resolution

Aspose.BarCode for Python via .NET allows developers to customize barcode image resolution settings using class Unit. This class includes the resolution property to modify barcode image resolution and the pixels property to convert all non-pixel size measurements into digital coordinates in pixels. To convert size values into requested supported units, the following properties can be used: inches, millimeters, document, point, and pixels.

Barcode images with different resolution settings are given below.

Resolution Is Set to 96 dpi Is Set to 300 dpi