How to make a minimal QR code

I’m using Aspose.Barcode22.6.0.
I want to make an 8mm x 8mm QR code. (not microQR)

The above document says that you can create a QR code with a minimum size of 5.25 mm x 5.25 mm, but I could not create a QR code that small.

Setting XDimension.Pixels to 1.5f or less produces something that cannot be read as a QR code.
Is there a way to make it even smaller?

I am attaching the code.

var gen = new BarcodeGenerator(EncodeTypes.QR, "12345678/ZZZ999/12345678");

var barcode = gen.Parameters.Barcode;
barcode.CodeTextParameters.Location = CodeLocation.None;
barcode.XDimension.Pixels = 1.5f;
barcode.QR.QrEncodeType = QREncodeType.ForceQR;
barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
barcode.QR.QrVersion = QRVersion.Version01;

gen.Save(@"C:\test\test.emf", BarCodeImageFormat.Emf);


Thanks for the code segment and details.

Could you please try using the line instead if it works for your needs.
barcode.XDimension.Pixels = .6f;

If you still have any issue, kindly share a sample QR code image with your desired size (8mm x 8mm). We will check it soon.

var gen = new BarcodeGenerator(EncodeTypes.QR, "12345678/ZZZ999/12345678");
gen.Parameters.Resolution = 300;
gen.Parameters.Barcode.XDimension.Millimeters = 0.2f;
gen.Save(@"C:\test\test.emf", BarCodeImageFormat.Emf);

hi amjad.sahi and alexander.gavriluk
Thanks for answering.

XDimension.Pixels could not make it any smaller,
I was able to make it even smaller by specifying Resolution and XDimension.Millimeters. thank you.

However, there is something I don’t quite understand about this parameter.
The attached files are the emf and svg files created with the settings “Resolution: 300” and “XDimension.Millimeters: 0.2f”.

QR size is
emf is 3.47mm
svg is 14.81mm
And there was a big difference.

Especially for svg, the size of one cell is 0.7056mm,
Since this is “XDimension.Millimeters: 0.2f”,
If “XDimension.Millimeters: 0.1f”, the size of one cell is 0.3527mm,
In other words, 1 point = 0.3527mm, the unit looks like a point.

After hearing your answer, I have more doubts and would like to ask you again,
In the end, aren’t they both “Millimeters”? I thought.

Best regard. (46.2 KB)

EMF format has embedded resolution ([MS-EMF]: Enhanced Metafile Format 2.2.9 Header Object).

SVG format does not have embedded resolution and we generate them in pixels. But SVG is a vector format and you can scale it to any size.

SVG has embedded resolution 96dpi, but we renders with set resolution because in this way we can generate more precise image for text and some non-square barcodes like MaxiCode or DotCode.