Free Support Forum - aspose.com

Problem saving image to resolution above 240dpi

We are using this code
// The path to the documents directory.

string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();

// Instantiate barcode object and set CodeText & Barcode Symbology

BarcodeGenerator generator = new BarcodeGenerator (EncodeTypes.Code128);

generator.CodeText = “1234567”;

generator.Parameters.Resolution = 300f;

// Save the image to your system and set its image format to Jpeg

generator.Save(dataDir + “barcode-image-resolution_out.jpeg”, BarCodeImageFormat.Jpeg);

I am unable to save a barcode image to a file that is at the resolution I specified. If I use 300 as in the example above, I get an image that is 240dpi. The documentation says I should be able to go to 400dpi but when I use values above 240 I still end up with a 240dpi image according to Infraview 64bit.

Is this a bug or must I do something else to write to a file in the correct DPI?

@TurboCooler,
Thank you for your query. We will analyze this issue soon and provide our feedback at the earliest.

@TurboCooler,
I have tried your sample code and analyzed the output image by displaying its properties in Windows Explorer, Photoshop and IrfanView (I could not find any software named Infraview 64bit as you mentioned). It is observed that DPI is set in the image as in the sample code and no issue is observed. Could you please share how are you checking the resolution for our reference? We will review the feedback and provide assistance accordingly. Please ensure that you use latest version of Aspose.BarCode in your testing.

Photoshop.PNG (47.0 KB)
WindowsExplorer.PNG (12.8 KB)
barcode-image-resolution_out.jpeg (28.7 KB)
IrfanView.PNG (55.2 KB)