Resizing QR Code as Image
Resizing a QR code is a critical step in ensuring that your digital assets remain functional across various mediums, from high-resolution print marketing to small-scale mobile app interfaces. By adjusting the pixel dimensions, you can prevent pixelation and ensure the scanning hardware can accurately detect the data matrix at various distances. Using IronQR, developers can precisely control the output resolution, ensuring the generated QR code maintains its structural integrity and "quiet zone" regardless of the final display size.
5-step guide for resizing a QR code
- using IronQr;
- string url = "https://ironsoftware.com/csharp/qr/";
- QrStyleOptions styleOptions = new QrStyleOptions { Dimensions = 500 };
- AnyBitmap qrResized = qr.Save(styleOptions);
- qr.Save(styleOptions).SaveAs("qr-resized.png");
Code Explanation
First, the IronQr namespace is imported to facilitate the generation and rendering process. The target URL is defined and processed by the QrWriter.Write method, which creates the internal data structure for the QR code.
Next, the QrStyleOptions class is used to control the physical output. By setting the Dimensions property, you specify the exact pixel width and height for the final image. Since QR codes are square, this value applies to both axes, ensuring a 1:1 aspect ratio. Finally, the Save method applies these style configurations to the QR data, and SaveAs exports the high-resolution bitmap to a local file.





