We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

What's the relationship between Barcode's resolution and image size?

Hi Support,
I’m using Barcode java API to generate barcode image.
I’m a bit confused about the relationship between barcode’s customized resolution and image size.
Could you please give an explanation about it?



Aspose.BarCode provides the Resolution class that developers can use to customize the resolution of barcode images.
The Resolution class has the following major properties:

  • The setDpiX() method is used to set horizontal resolution in dots per inch (DPI).
  • The setDpiY() method is used to set vertical resolution in dots per inch (DPI).

The setDpiX() and setDpiY() methods of the Resolution class accept simple float values to configure horizontal and vertical resolutions.
DPI is a measure of image resolution that specifies the number of dots that a printer or device (like a monitor) can display per linear inch. The higher the DPI, the higher the resolution.

Whereas Aspose.BarCode for Java automatically adjusts the image size (width and height) according to the generated barcode’s size. The image size can also be controlled by specifying the image height and width using the setImageHeight() and setImageWidth() methods. setAutoSize() should be set to false to customize the image size.

Thanks for providing these detailed information.

How does resolution works when i set both image width , image height and resolution meanwhile ?



Image width and height shall set the display size of your barcode image whereas the resolution settings shall set the DPI measurements, the image display quality settings.

Please find the code sample on this link: