Free Support Forum - aspose.com

How to set the QR Code Image Dimensions

Hi

I want to generate a standard QR Code with size = 76px by 76px.
Can you please show me how to do this.

Tony

@tony.woods.bell.ca,
We are analyzing this issue and will share our feedback soon.

There is not QR with 76x76, there is only 77x77. It is 15 version. You can use this code:

lBld.Parameters.Barcode.QR.QrVersion = QRVersion.Version15;

can i override it with something likeā€¦

generator.Parameters.AutoSizeMode = AutoSizeMode.None;
generator.Parameters.ImageHeight.Pixels = 74;
generator.Parameters.ImageWidth.Pixels = 74;

No, ImageHeight/ImageWidth is just image size.

To generate QR code with defined image size you need to use AutoSizeMode.Interpolation, but image can be blurred. AutoSizeMode.Nearest generates close to 74x74 image size. However you can center image if you want.

generator.Parameters.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.Interpolation;

Thank you for the info.
one more question.

There is a white margin (padding) around the QR Code.
Is there a way to remove this?

lBld.Parameters.Barcode.Padding.Left.Pixels = 0;
lBld.Parameters.Barcode.Padding.Top.Pixels = 0;
lBld.Parameters.Barcode.Padding.Right.Pixels = 0;
lBld.Parameters.Barcode.Padding.Bottom.Pixels = 0;

But you should left white zone to make barcode detectable. Quiet zone is required by standard, avoiding it makes your barcode unrecognizable on some equipment.

Thank you for the info. It works.
And re. quite zone, I will keep that in mind.
thank you!!