IronBarcode 操作指南 設置錯誤更正 How To Set Error Correction Hairil Hasyimi Bin Omar 更新日期:7月 22, 2025 Download IronBarcode NuGet 下載 DLL 下載 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English 錯誤更正 在條碼中指的是即使有視覺缺陷或編碼錯誤,仍能保持條碼可讀性的能力。 這些損傷可能由於印刷缺陷、污漬、刮痕或掃描條件變動等因素引起。 錯誤更正是決定哪種類型的條碼編碼合適的一個重要因素。 一般來說,由於以下因素,2D 條碼比 1D 條碼對缺陷具有更高的容忍度: 數據容量:由於 2D 條碼橫向和縱向編碼,可以存儲顯著更多的數據,承載字母數字、二進制數據、圖像等。 冗餘: 2D 條碼有多層數據編碼,即使條碼部分損壞,也可以從剩餘完整的部分提取信息。 緊湊性:由於形狀緊湊,2D 條碼適合於有限空間。 靈活性: 2D 條碼可以從不同角度和方位掃描。 快速入門:在 QR 碼創建中使用錯誤更正級別 這個簡短示例展示了如何輕鬆地使用 IronBarcode 生成 QR 碼,將錯誤更正級別設置為中等。 開發者可在幾秒內上手,使用 CreateQrCode 方法設置大小、內容和錯誤更正級別。 Get started making PDFs with NuGet now: Install IronBarcode with NuGet Package Manager PM > Install-Package BarCode Copy and run this code snippet. var qr = IronBarCode.QRCodeWriter.CreateQrCode("https://ironsoftware.com", 500, IronBarCode.QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("qr.png"); Deploy to test on your live environment Start using IronBarcode in your project today with a free trial Free 30 day Trial class="hsg-featured-snippet"> 最小流程(5 步) 下載 C# 庫以調整條碼的錯誤更正 使用 QRCodeWriter 類生成 QR 碼 修改 QrErrorCorrection 參數以調整錯誤更正級別 在四個不同的錯誤更正級別可視化地比較生成的 QR 碼 檢查輸出的 QR 碼 調整 QR 碼中的錯誤更正範例 目前,IronBarcode 支援在 QR 碼、微型 QR 和 rMQR 中設置錯誤更正。 它支援 QR 碼標準指定的所有四個預設錯誤更正級別。 錯誤更正級別通過 QRCodeWriter.CreateQrCode 方法中的 QrErrorCorrection 參數調整。 錯誤更正的四個級別是: 最高:級別 H。 可恢復最多 30% 的數據。 高:級別 Q。 可恢復最多 25% 的數據。 中等:級別 M。 可恢復最多 15% 的數據。 低:級別 L。 可恢復最多 7% 的數據。 更高的錯誤更正級別會導致更複雜的 QR 碼影像,需在生成 QR 碼時在視覺清晰度和錯誤更正之間取得平衡。 以下範例代碼展示了如何設置錯誤更正: :path=/static-assets/barcode/content-code-examples/how-to/set-error-correction.cs // Import the necessary namespace for barcode generation using IronBarCode; // Create a QR code with the specified URL, size, and error correction level GeneratedBarcode mediumCorrection = QRCodeWriter.CreateQrCode( "https://ironsoftware.com/csharp/barcode/", // URL to be encoded in the QR code 500, // Size of the QR code (500x500 pixels) QRCodeWriter.QrErrorCorrectionLevel.Medium // Error correction level to handle distortions ); // Save the generated QR code image as a PNG file with the specified filename mediumCorrection.SaveAsPng("mediumCorrection.png"); ' Import the necessary namespace for barcode generation Imports IronBarCode ' Create a QR code with the specified URL, size, and error correction level Private mediumCorrection As GeneratedBarcode = QRCodeWriter.CreateQrCode("https://ironsoftware.com/csharp/barcode/", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium) ' Save the generated QR code image as a PNG file with the specified filename mediumCorrection.SaveAsPng("mediumCorrection.png") $vbLabelText $csharpLabel 錯誤更正比較 以下是 QR 碼影像的樣本集,每個圖像代表相同的值但具有不同的錯誤更正級別。 如觀察所示,更高的錯誤更正級別會導致更複雜的 QR 碼影像,提供更高的容錯能力。 class="competitors-section__wrapper-even-1"> 最高錯誤更正 高錯誤更正 class="competitors-section__wrapper-even-1"> 中等錯誤更正 低錯誤更正 常見問題解答 條碼中的錯誤更正是什麼?為什麼它很重要? 條碼中的錯誤更正是一種能夠在視覺缺陷或編碼錯誤(如污漬或刮痕)下保持可讀性的能力。此功能對於確保條碼應用程序中的數據準確性和可靠性至關重要。 2D 條碼在錯誤更正方面與 1D 條碼有何不同? 2D 條碼與 1D 條碼不同之處在於其數據容量更大、冗餘度高、緊湊性強和靈活性高。這使得 2D 條碼更能抵禦損壞並且可以從各種角度輕鬆掃描,增強了其錯誤更正能力。 如何在 C# 中設置二維碼的錯誤更正級別? 要在 C# 中設置二維碼的錯誤更正級別,可以使用 IronBarcode 庫。下載該庫,使用 QRCodeWriter 類,並調整 QrErrorCorrection 參數以設置所需的錯誤更正級別。 二維碼可用的錯誤更正級別有哪些? 二維碼支持四種錯誤更正級別:最高(H 級,30% 的數據恢復)、高(Q 級,25% 的數據恢復)、中(M 級,15% 的數據恢復)和低(L 級,7% 的數據恢復)。這些級別決定了如果二維碼受損時可以恢復多少數據。 修改錯誤更正級別如何影響二維碼的外觀? 修改錯誤更正級別會影響二維碼的複雜性。更高的錯誤更正級別會產生更複雜的圖像,在視覺清晰度和數據恢復能力之間取得平衡。 在 C# 中使用什麼方法創建具有特定錯誤更正的二維碼? 在 C# 中,使用 QRCodeWriter.CreateQrCode 方法生成具有指定錯誤更正級別的二維碼,方法是調整 QrErrorCorrection 參數。 此庫能否將錯誤更正應用於除二維碼以外的其他條碼類型? 是的,IronBarcode 庫支持在其他條碼類型(如 Micro QR 和 rMQR)中進行錯誤更正,除了二維碼以外。 錯誤更正對條碼的數據容量有何影響? 更高的錯誤更正級別會降低條碼的數據容量,因為需要更多空間來存儲錯誤更正數據,從而減少可用於實際數據的空間。 Hairil Hasyimi Bin Omar 立即與工程團隊聊天 軟體工程師 和所有优秀的工程师一样,Hairil 是个努力学习者。他正在细化自己的 C# 、Python 和 Java 知识,将这些知识应用于 Iron Software 各个团队成员以增加价值。Hairil 自马来西亚 Universiti Teknologi MARA 加入 Iron Software 团队,并以化学与工艺工程学士学位毕业。 準備好開始了嗎? Nuget 下載 1,935,276 | 版本: 2025.11 剛剛發布 免費 NuGet 下載 總下載量:1,935,276 查看許可證