Set Barcode Size and Resolution in Python via Java
This article describes how to manage settings provided by Aspose.BarCode for Python via Java 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 Java includes a special class called Unit and its method called updateResolution that is intended to manage barcode resolution measured in dots per inch (dpi). Class Unit provides various methods 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 special methods of class BarcodeParameters, such as setBarCodeHeight, setBarCodeWidth, and setXDimension. Aspose.BarCode for Python via Java determines measurement units in the GraphicsUnit enum that is defined as an internal representation of a Java interface called java.lang.Comparable
Barcode labels created using various unit settings are shown below.
Size Units | Pixels | Millimeters |
---|---|---|
Image Resolution
Aspose.BarCode for Python via Java allows developers to customize barcode image resolution settings using class Unit. This class includes the updateResolution method to modify barcode image resolution and the setPixels method to convert all non-pixel size measurements into digital coordinates in pixels. To convert size values into requested supported untis, special methods can be used: setInches, setMillimeters, setDocument, setPoint, and setPixels.
Barcode images with different resolution settings are given below.
Resolution | Is Set to 96 dpi | Is Set to 300 dpi |
---|---|---|