How does Barcode customized resolution and image size work together?

Hi, Support,
I’m now using Barcode Java API to generate Barcode image as below.
BarCodeBuilder bb = new BarCodeBuilder();
bb.setCodeText(“1234567890”);
bb.setSymbologyType(Symbology.Code128);
bb.setGraphicsUnit(GraphicsUnit.Pixel);
bb.setAutoSize(false);
bb.setImageHeight(100f);
bb.setImageWidth(300f);
bb.getResolution().setDpiX(100f);
bb.getResolution().setDpiY(100f);
bb.getResolution().setMode(ResolutionMode.Customized);
bb.save(String.valueOf(“ba_16.jpg”), ImageFormat.getJpeg());

   seems the DPI set here only has impact on the code text's size,   I could not see any impact on the image's quality from different DPI setting.

   Could you please show me how the DPI here works on the resulting image? 

Thanks
Jacky

@yixli,

We were able to reproduce the issue reported by you. We have logged a ticket as BARCODEJAVA-574 in our issue tracking system against it. We will update you here as soon as additional information is available.

@yixli,

You may use the code snippet given below to change the height of the Barcode. The resolution only affects text in this case.

bb.setBarHeight(60);

You may also use the new Barcode Generation API to generate Barcode as shown in the example below.

BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.CODE_128, "1234567890");
generator.setAutoSizeMode(AutoSizeMode.Nearest);
generator.getBarCodeWidth().setPixels(300);
generator.getBarCodeHeight().setPixels(100);
generator.save("barcode.jpg", BarCodeImageFormat.Jpeg);

To generate Barcode with 300 DPI, you may use the code snippet given below.

BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.CODE_128, "1234567890");
generator.setAutoSizeMode(AutoSizeMode.Nearest);
generator.setResolution(300);
generator.save("barcode300.jpg", BarCodeImageFormat.Jpeg);

When the size of the Barcode is defined in pixels, it stays within those bounds.
We hope that this answered your question. If the issue still persists, please provide the specifications of the Barcode that you are trying to generate so that we can assist you further. Please also make sure that you are using the latest version of Aspose.Barcode for Java API.

Thanks for clarifying on the usage, it does make sense, thanks!