How to Customize and Add Logos to QR Codes in C#
Customize QR codes in C# by adding logos, changing colors, and including annotations using IronBarcode's CreateQrCodeWithLogo method and styling features to create branded, professional QR codes for marketing and business applications.
QR codes have gained popularity over traditional barcodes due to their higher data capacity and ease of scanning. They are especially valued in marketing for their customizability, including options for adding logos, changing colors, and incorporating other branding elements. Modern businesses leverage custom QR codes for various marketing campaigns and customer engagement strategies.
To meet this demand, IronBarcode offers a suite of features for customizing QR codes. Users can create QR codes with logos, change color schemes, and add annotations. These capabilities are powered by IronDrawing, a free and open-source library. The library supports multiple barcode formats including standard QR codes, Micro QR, and the latest rMQR formats.
Quickstart: Build a Branded QR Code in One Line
Get started instantly by creating a QR code with your logo, custom color, and annotation—all with minimal setup and just one line of IronBarcode code. Perfect for developers who want professional branding fast.
Get started making PDFs with NuGet now:
Install IronBarcode with NuGet Package Manager
Copy and run this code snippet.
IronBarCode.QRCodeWriter.CreateQrCodeWithLogo("https://example.com", new IronBarCode.QRCodeLogo("logo.png"), 300).ChangeBarCodeColor(IronSoftware.Drawing.Color.DeepSkyBlue).AddAnnotationTextAboveBarcode("Scan Me", new IronSoftware.Drawing.Font("Verdana",12), IronSoftware.Drawing.Color.White, 5).SaveAsPng("customQR.png");Deploy to test on your live environment
Minimal Workflow (5 steps)
- Download the C# library for customizing QR codes
- Use
CreateQrCodeWithLogoto create a QR code with a logo - Apply custom colors with
ChangeBarCodeColor - Add annotations using
AddAnnotationTextAboveBarcode - Display QR code value with
AddBarcodeValueTextBelowBarcode
How Do I Create QR Codes With a Logo?
A QRCodeLogo object is required to embed the logo image while generating the QR code. The CreateQrCodeWithLogo method generates a QR code with a logo. This method is part of IronBarcode's comprehensive QR code generation features, which provide extensive customization options for developers.
:path=/static-assets/barcode/content-code-examples/how-to/customize-qr-code-style-logo.csusing IronBarCode;
using IronSoftware.Drawing;
AnyBitmap qrlogo = AnyBitmap.FromFile("ironbarcode_top.webp");
QRCodeLogo logo = new QRCodeLogo(qrlogo, 0, 0, 20f);
GeneratedBarcode QrCodeWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250);
QrCodeWithLogo.SaveAsPng("QrCodeWLogo2.png");
Imports IronBarCode
Imports IronSoftware.Drawing
Private qrlogo As AnyBitmap = AnyBitmap.FromFile("ironbarcode_top.webp")
Private logo As New QRCodeLogo(qrlogo, 0, 0, 20F)
Private QrCodeWithLogo As GeneratedBarcode = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250)
QrCodeWithLogo.SaveAsPng("QrCodeWLogo2.png")
Let's examine the output QR code generated by the code above. The QR code features a logo in the center with rounded edges. The logo integration maintains the QR code's scannability while adding brand identity.
What Parameters Control Logo Appearance?
To customize the logo, fill in specific fields when creating a new QRCodeLogo object. Here are the required fields:
- Importing Image: Import images from
AnyBitmap,Stream,Byte Array, relativefilepath, orURI. For optimal results, use high-resolution images in common formats like PNG, JPEG, or WebP. - Image Dimensions: Specify the desired width and height in pixels. If the image is too large for the QR code to remain readable, an exception will be thrown. Use 0 to automatically determine the largest viable size.
- Image Corners: Set the radius for rounded corners. Use 0 for square corners. Rounded corners create a more professional appearance and better visual integration.
How Do I Export the Generated QR Code?
To export the generated QR code, invoke a save method. Export options include image files, Streams, HTML, and PDF. Learn more about exporting barcodes as different formats in our comprehensive guide. For web applications, you can also export barcodes as HTML for direct embedding in web pages.
How Can I Change the Color of My QR Code?
Besides adding logos, IronBarcode enables users to customize QR codes by changing their color. With IronDrawing, users can define colors using RGB values or Hex color codes and apply them to QR codes. This feature is particularly useful for maintaining brand consistency across marketing materials. Let's examine a code snippet demonstrating this feature and the resulting QR code.
:path=/static-assets/barcode/content-code-examples/how-to/customize-qr-code-style-logo-color.csusing IronBarCode;
using IronSoftware.Drawing;
AnyBitmap qrlogo = AnyBitmap.FromFile("ironbarcode_top.webp");
QRCodeLogo logo = new QRCodeLogo(qrlogo, 0, 0, 20f);
IronSoftware.Drawing.Color ColorFromRgb = new IronSoftware.Drawing.Color(51, 51, 153);
GeneratedBarcode QrCodeWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250);
GeneratedBarcode QrCodeWithLogoAndColor = QrCodeWithLogo.ChangeBarCodeColor(ColorFromRgb);
QrCodeWithLogoAndColor.SaveAsPng("ColorQrCodeWithLogo.png");Imports IronBarCode
Imports IronSoftware.Drawing
Private qrlogo As AnyBitmap = AnyBitmap.FromFile("ironbarcode_top.webp")
Private logo As New QRCodeLogo(qrlogo, 0, 0, 20F)
Private ColorFromRgb As New IronSoftware.Drawing.Color(51, 51, 153)
Private QrCodeWithLogo As GeneratedBarcode = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250)
Private QrCodeWithLogoAndColor As GeneratedBarcode = QrCodeWithLogo.ChangeBarCodeColor(ColorFromRgb)
QrCodeWithLogoAndColor.SaveAsPng("ColorQrCodeWithLogo.png")
What Color Formats Are Supported?
The code above extends the previous example of creating QR codes with logos. It demonstrates changing QR code color using the ChangeBarCodeColor method, which takes an IronSoftware.Drawing.Color object as input. Create this object using RGB values, Hex codes, or predefined enums. Visit our "Create Color" code example to learn more. The color customization feature works seamlessly with all supported barcode formats.
When Should I Use Custom Colors?
Custom colors are particularly useful for:
- Brand consistency: Matching QR codes to your company's visual identity
- Campaign themes: Creating themed QR codes for special campaigns and events
- Visual hierarchy: Using color to highlight important QR codes in print materials
- Accessibility: Ensuring sufficient contrast for better scanning in various conditions
When selecting colors, maintain adequate contrast between the QR code pattern and background to ensure reliable scanning. Dark colors on light backgrounds typically work best.
How Do I Add Annotations to QR Codes?
Another important aspect of customizing QR codes is adding annotations within the QR code image. These annotations can be the barcode value itself or custom text for promotional purposes. Annotations help users understand what the QR code contains before scanning, improving user experience and engagement rates.
Let's examine the implementation of these methods and the resulting QR code image.
:path=/static-assets/barcode/content-code-examples/how-to/customize-qr-code-style-logo-color-annotation.csusing IronBarCode;
using IronSoftware.Drawing;
AnyBitmap qrlogo = AnyBitmap.FromFile("ironbarcode_top.webp");
QRCodeLogo logo = new QRCodeLogo(qrlogo, 0, 0, 20f);
Color colorForBarcode = new Color(51, 51, 153); // color from RGB
Color annotationAboveBarcodeColor = new Color("#176feb"); // color from Hex
Font annotationAboveBarcodeFont = new Font("Candara", FontStyle.Bold, 15);
Color barcodeValueBelowBarcodeColor = new Color("#6e53bb");
Font barcodeValueBelowBarcodeFont = new Font("Cambria", FontStyle.Regular, 15);
GeneratedBarcode qrCodeWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250);
GeneratedBarcode qrCodeWithLogoAndColor = qrCodeWithLogo.ChangeBarCodeColor(colorForBarcode);
GeneratedBarcode qrCodeWithAnnotation = qrCodeWithLogoAndColor.AddAnnotationTextAboveBarcode("IronBarcodeRocks!", annotationAboveBarcodeFont, annotationAboveBarcodeColor, 2).AddBarcodeValueTextBelowBarcode(barcodeValueBelowBarcodeFont, barcodeValueBelowBarcodeColor, 2);
qrCodeWithAnnotation.SaveAsPng("QRCodeWithAnnotation.png");Imports IronBarCode
Imports IronSoftware.Drawing
Private qrlogo As AnyBitmap = AnyBitmap.FromFile("ironbarcode_top.webp")
Private logo As New QRCodeLogo(qrlogo, 0, 0, 20F)
Private colorForBarcode As New Color(51, 51, 153) ' color from RGB
Private annotationAboveBarcodeColor As New Color("#176feb") ' color from Hex
Private annotationAboveBarcodeFont As New Font("Candara", FontStyle.Bold, 15)
Private barcodeValueBelowBarcodeColor As New Color("#6e53bb")
Private barcodeValueBelowBarcodeFont As New Font("Cambria", FontStyle.Regular, 15)
Private qrCodeWithLogo As GeneratedBarcode = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", logo, 250)
Private qrCodeWithLogoAndColor As GeneratedBarcode = qrCodeWithLogo.ChangeBarCodeColor(colorForBarcode)
Private qrCodeWithAnnotation As GeneratedBarcode = qrCodeWithLogoAndColor.AddAnnotationTextAboveBarcode("IronBarcodeRocks!", annotationAboveBarcodeFont, annotationAboveBarcodeColor, 2).AddBarcodeValueTextBelowBarcode(barcodeValueBelowBarcodeFont, barcodeValueBelowBarcodeColor, 2)
qrCodeWithAnnotation.SaveAsPng("QRCodeWithAnnotation.png")
What Annotation Methods Are Available?
IronBarcode provides methods for setting the annotation's position (above or below the QR code) as well as its font family and color. Available methods include:
AddAnnotationTextAboveBarcode: Adds annotation text above the QR codeAddAnnotationTextBelowBarcode: Adds annotation text below the QR codeAddBarcodeValueTextAboveBarcode: Adds barcode value text above the QR codeAddBarcodeValueTextBelowBarcode: Adds barcode value text below the QR code
These methods can be chained together for multiple annotations. For more advanced styling options, refer to our comprehensive barcode styling guide.
How Can I Customize Annotation Appearance?
All four methods accept a custom font as an IronSoftware.Drawing.Font object, color as an IronSoftware.Drawing.Color object, and an integer to specify the top and bottom spacing in pixels. These parameters are optional; if not specified, default font, color, and spacing will be used. The Font object supports various font families, styles (Bold, Italic, Regular), and sizes to match your branding requirements.
Why Use Annotations on QR Codes?
Annotations enhance QR codes by:
- Providing context: Labels like "Scan for Menu" or "Visit Our Website" clarify purpose
- Improving engagement: Clear calls-to-action increase scan rates
- Building trust: Displaying the URL or company name helps users feel secure
- Enhancing accessibility: Text annotations help users understand content without scanning
IronBarcode is an ideal tool for creating and customizing QR codes. Beyond the direct customization methods, IronBarcode uses IronDrawing as a helper library for image processing, providing more stability than depending on external libraries. For additional examples and advanced techniques, explore our C# QR Code Generator tutorial and API Reference for complete documentation of all available methods and properties.
Frequently Asked Questions
How do I add a logo to a QR code in C#?
You can add a logo to a QR code using IronBarcode's CreateQrCodeWithLogo method. Simply create a QRCodeLogo object with your image file path and pass it to the method along with your QR code data. The logo will be embedded in the center of the QR code while maintaining scannability.
Can I change the colors of my QR code?
Yes, IronBarcode provides the ChangeBarCodeColor method that allows you to customize QR code colors. You can apply any color from the IronSoftware.Drawing.Color palette to match your brand identity while ensuring the QR code remains scannable.
How do I add text annotations to a QR code?
IronBarcode offers methods like AddAnnotationTextAboveBarcode and AddBarcodeValueTextBelowBarcode to add text annotations. You can customize the font, size, color, and positioning of the text to create informative labels or calls-to-action on your QR codes.
What barcode formats are supported for customization?
IronBarcode supports customization for multiple barcode formats including standard QR codes, Micro QR codes, and the latest rMQR formats. Each format can be customized with logos, colors, and annotations to meet your specific requirements.
Can I create a branded QR code with just one line of code?
Yes, IronBarcode allows you to create a fully branded QR code in one line by chaining methods. You can combine CreateQrCodeWithLogo, ChangeBarCodeColor, and AddAnnotationTextAboveBarcode methods to generate a custom QR code with logo, colors, and text all at once.
What image formats can I use for QR code logos?
IronBarcode's QRCodeLogo feature supports common image formats like PNG, JPG, and other standard formats. The library automatically processes and embeds your logo image while maintaining optimal QR code readability.
How does logo integration affect QR code scannability?
IronBarcode automatically positions logos in the center of QR codes with appropriate sizing and padding to maintain scannability. The library ensures that the logo doesn't interfere with the QR code's error correction capabilities, keeping it readable by standard QR code scanners.






