How to Resize a QR Code Image
Proper scaling keeps QR codes scannable across print and digital formats. Accurate dimensions prevent blurring and ensure clear readability.
In this how-to guide, we will explore how the resizing of a QR code is performed using IronQR.
How to Resize a QR Code Image
- Download the IronQR C# library to resize QR codes
- Create a
QrStyleOptionsobject - Set the
Dimensionsproperty for the required size - Generate the QR code
- Save the resized QR code
Resizing QR Code
To create a custom-sized QR code for print or signage, set the Dimensions property to a specific value, then save the generated QR code with the QrStyleOptions applied.
In the example, we create a QR code from a URL, apply a custom size of 500 pixels using the Dimensions property of the QrStyleOptions class, and save the resized QR code as a PNG.
Dimensions property provides a direct 1:1 mapping; the integer you define becomes the exact pixel width and height of the final output.using IronQr;
using IronSoftware.Drawing;
string url = "https://ironsoftware.com/csharp/qr/";
// Generate the QR code data
QrCode qr = QrWriter.Write(url);
// Save using default dimensions
AnyBitmap qrDefault = qr.Save();
qrDefault.SaveAs("qr-default-size.png");
// Define custom resizing
QrStyleOptions styleOptions = new QrStyleOptions
{
Dimensions = 500
};
// Save using the style options
AnyBitmap qrResized = qr.Save(styleOptions);
qrResized.SaveAs("qr-resized.png");Imports IronQr
Imports IronSoftware.Drawing
Dim url As String = "https://ironsoftware.com/csharp/qr/"
' Generate the QR code data
Dim qr As QrCode = QrWriter.Write(url)
' Save using default dimensions
Dim qrDefault As AnyBitmap = qr.Save()
qrDefault.SaveAs("qr-default-size.png")
' Define custom resizing
Dim styleOptions As New QrStyleOptions With {
.Dimensions = 500
}
' Save using the style options
Dim qrResized As AnyBitmap = qr.Save(styleOptions)
qrResized.SaveAs("qr-resized.png")Original

Resized

Frequently Asked Questions
What is the recommended library for resizing QR code images in C#?
The recommended library for resizing QR codes in C# is the IronQR library, which provides functionalities such as setting the Dimensions property for custom sizes.
How can I resize a QR code using IronQR?
To resize a QR code using IronQR, first create a QrStyleOptions object, set the Dimensions property to the desired size, generate the QR code, and save it with the applied style options.
What property is used to set the size of a QR code in IronQR?
The Dimensions property is used to set the size of a QR code in IronQR, allowing you to specify its width and height in pixels.
Can I use IronQR to resize QR codes for both print and digital formats?
Yes, IronQR can resize QR codes for both print and digital formats by adjusting the Dimensions property to ensure scannability and clear readability.
What is the default format for saving a QR code using IronQR?
Using IronQR, the default format for saving a QR code is PNG, although you can choose other formats supported by the AnyBitmap class.
How does the Dimensions property affect the output of a QR code?
The Dimensions property provides a direct 1:1 mapping where the defined integer becomes the exact pixel width and height of the final QR code output.
Is it necessary to download the IronQR library separately?
Yes, you need to download the IronQR C# library from NuGet or any other package repository to use its QR code resizing features.
Can IronQR handle resizing to specific dimensions accurately?
Yes, IronQR can resize QR codes to specific dimensions accurately by using the Dimensions property for precise pixel size adjustments.
What are the steps involved in generating a QR code with custom dimensions?
The steps to generate a QR code with custom dimensions include downloading IronQR, creating a QrStyleOptions object, setting the Dimensions, generating the QR code, and saving it.

Ahmad is a full-stack developer with a strong foundation in C#, Python, and web technologies. He has a deep interest in building scalable software solutions and enjoys exploring how design and functionality meet in real-world applications.