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?
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.
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.