دليل تقني · ISO/IEC 18004
كيف يتم إنشاء رموز QR؟ شرح كامل لعملية الترميز
إنشاء رمز QR هو تطبيق مباشر لترميز ISO/IEC 18004: يحوّل رابط URL أو نصاً أو حمولة بيانات إلى مصفوفة مربعة من الوحدات قبل أن يمسحها أي شخص. يتناول هذا الدليل لعام 2026 مراحل إنشاء الرمز فقط، من اختيار وضع البيانات حتى التصدير النهائي.
كيف تُنشأ رموز QR؟
ماذا يعني إنشاء رمز QR؟
A QR code is a two-dimensional barcode symbology. Its black and white squares are modules, and their arrangement carries both payload data and the instructions a scanner needs to interpret it.
A QR generator analyzes input and applies the ISO/IEC 18004 rules for capacity, structure, and error correction. A scanner performs the reverse operation; for that decoding flow, see how QR codes work.
A static QR code stores its final payload in the symbol. A dynamic QR code stores a redirect URL in the same kind of symbol, while its editable destination and later analytics live outside the encoding process.
ما هو مسار إنشاء رمز QR؟
يساعد هذا المسار في تقييم مكتبة QR أو فهم ما يفعله المولّد عند معالجة عنوان URL.
- 1
Analyze input and choose a data mode
The generator selects numeric, alphanumeric, byte, or Kanji encoding from the characters in the payload.
- 2
Encode data into codewords
Mode and character-count indicators, payload bits, a terminator, and padding are formed into eight-bit codewords.
- 3
Generate error correction
Reed-Solomon arithmetic creates redundant codewords for the selected recovery level.
- 4
Structure the final message
Data and error-correction blocks are interleaved in the order required by the selected version and level.
- 5
Construct the matrix
The generator chooses a QR version and reserves finder, timing, alignment, and information areas.
- 6
Place data bits
Codeword bits travel through remaining modules in a vertical zigzag pattern, with remainder bits where required.
- 7
Evaluate mask patterns
All eight XOR masks are scored to avoid patterns that are difficult for cameras to distinguish.
- 8
Insert format and version information
The chosen error-correction level and mask are BCH-protected; versions 7 and above also receive version information.
- 9
Add the quiet zone
A clear border at least four modules wide separates the symbol from neighboring artwork.
- 10
Export and validate
The finished matrix can be rendered as PNG, SVG, PDF, or EPS and tested at its intended print size.
الخطوة 1: كيف يختار المولّد وضع بيانات QR؟
وضع البيانات هو مجموعة القواعد التي تحوّل الأحرف إلى بتات. يستخدم عنوان مثل https://example.com عادة وضع البايت؛ وكذلك سلسلة WiFi، وإن كانت بنيتها مختلفة.
| الوضع | مجموعة الأحرف | الأفضل لـ |
|---|---|---|
| Numeric | 0–9 | Phone numbers, numeric IDs, and digits-only payloads |
| Alphanumeric | 0–9, A–Z, space, $ % * + - . / : | Uppercase coupon codes and simple identifiers |
| Byte | ISO 8859-1 or arbitrary byte sequences | URLs, email, WiFi strings, mixed-case and UTF-8 text |
| Kanji | Shift JIS double-byte characters | Eligible Japanese text |
Step 2: How is data encoded into codewords?
A codeword is an eight-bit unit of either encoded payload data or error-correction information. The mode indicator tells the decoder how to read the following bits, and the character-count indicator tells it how much data follows.
Payload length and error-correction level determine the smallest QR version with enough capacity. A longer URL or a higher recovery level can therefore increase the module count even when the visible design is unchanged.
Step 4: How is the QR matrix built?
Finder patterns are the three 7×7 corner markers that help a scanner locate and orient the code. Timing patterns synchronize the module grid, while alignment patterns improve geometric correction on larger versions.
The generator reserves areas for format information and, from Version 7 onward, version information before placing data. Version 40 reaches 177×177 modules.
Step 5: How are codewords placed in modules?
Each bit becomes one light or dark module after masking. Reserved function modules are skipped, and remainder bits fill any capacity that is not represented by a full codeword.
This placement rule is why a QR symbol is a structured matrix rather than a visual hash: every position has a prescribed role.
Step 6: What are QR code mask patterns?
The generator evaluates all eight masks and assigns penalty points for undesirable runs, blocks, and balance. It uses the lowest-penalty result and records the selected mask in format information.
Masking changes the visual distribution of modules, not the underlying payload. The scanner reads the mask identifier and reverses the operation during decoding.
Step 7: What are format and version information?
Format information is duplicated near the finder patterns because it is needed early in decoding. Version information is placed in reserved areas on larger symbols.
These fields are part of symbol generation, so a code that merely resembles a QR image is not necessarily a valid QR symbol.
Step 8: Why does the quiet zone matter in final output?
PNG is useful for fixed pixel output, while SVG, PDF, and EPS preserve vector edges for large-format printing. Raster scaling can blur individual modules, so print resolution must preserve a readable module size.
Use the QR code size guide for physical sizing rules; generation creates the symbol, while production choices determine how faithfully it is reproduced.
Static vs dynamic QR codes in the generation context
The entity chain is encoding → symbol → optional redirect layer → editable URL → scan analytics. Analytics attach when a dynamic redirect is requested, not while the QR matrix is generated.
Read about static vs dynamic QR codes for the business decision, and see plans for dynamic features without assuming every generator exposes low-level version or mask controls.
What happens in a typical QR generator, including QR-Build?
At QR-Build, we treat output validation as a production step: we review core symbol output and use cross-device scan tests on iPhone and Android before export. Compliant generators follow ISO/IEC 18004; implementation details and available controls vary, so verify them in vendor documentation.
Open-source libraries such as ZXing and qrcode.js implement the same core pipeline. Teams needing API-level evaluation can review our QR code generator for developers.
QR code generation vs QR code scanning
Understanding generation helps explain why quiet zones, module size, contrast, and error correction affect reliability. For the camera-detection and decoding sequence, read how QR codes work.
الخطوة 3: ما تصحيح أخطاء Reed-Solomon؟
النسب أدناه قدرات استعادة تقريبية مرتبطة عادة بكل مستوى؛ وتعتمد النتيجة الفعلية على موضع الضرر وطريقته.
| المستوى | الاستعادة التقريبية | الاستخدام المعتاد |
|---|---|---|
| L | ~7% | Clean digital displays with low damage risk |
| M | ~15% | Common general-purpose default; confirm a generator's setting |
| Q | ~25% | Outdoor placement or moderate wear |
| H | ~30% | Logo overlays, heavy print, or harsher environments |
إطار اختيار وضع البيانات وتصحيح الأخطاء
| الحالة | وضع البيانات | مستوى EC | نصيحة الإخراج |
|---|---|---|---|
| Phone number only | Numeric | M | Use SVG for print |
| Uppercase coupon code | Alphanumeric | M | Test contrast |
| URL or WiFi string | Byte | M; H with a logo | Preserve quiet zone |
| Logo overlay | Usually byte | H | Increase final print size |
| Outdoor sign | Usually byte | Q or H | Check the size guide |
| Campaign with URL changes | Byte + dynamic redirect | M | Use a redirect layer and scan analytics |
أخطاء شائعة عند إنشاء رمز QR
Cropping the quiet zone
Do not place a border, text, or artwork inside the required clear margin.
Using too little error correction for a logo
A logo obscures modules; compensate deliberately and test the final artwork.
Forcing the wrong character encoding
Mixed-case text and non-ASCII content often need byte-aware handling rather than an alphanumeric assumption.
Reducing contrast
Decorative colors can make module boundaries difficult for cameras to separate.
Shrinking a raster file too far
Blurred or merged pixels can destroy module geometry even when the source matrix was valid.
Trusting a QR-like image
A square pattern must include valid structure, information fields, and quiet zone to be spec-compliant.
أفضل الممارسات لإنشاء رموز QR موثوقة
Start with ISO/IEC 18004 output
Use a generator or library that documents standards-based QR encoding.
Match recovery to the environment
Factor in print wear, logo coverage, lighting, and expected viewing distance.
Keep the quiet zone intact
Treat the white border as part of the symbol, not as optional surrounding whitespace.
Test iOS and Android
Test the final printed or displayed asset, not only the source file on one screen.
Choose vector for large print
SVG, PDF, or EPS help preserve crisp module edges at larger dimensions.
Use dynamic QR codes for changing campaigns
An editable redirect destination avoids re-encoding when a campaign URL changes; scan analytics occur on that redirect layer.
مسرد مصطلحات إنشاء رمز QR
Module
One black or white square cell in a QR matrix.
Codeword
An eight-bit unit of encoded data or error-correction information.
Data mode
The character-encoding scheme selected before payload bits are created.
Error correction level
The L, M, Q, or H setting that controls redundant Reed-Solomon codewords.
Mask pattern
One of eight XOR templates used to improve module distribution.
Quiet zone
The required clear border of at least four modules around a QR symbol.
Finder pattern
One of the three large corner patterns that supports detection and orientation.
Alignment pattern
A smaller reference pattern that helps correct distortion in larger versions.
Timing pattern
Alternating modules that help synchronize the scanner to the grid.
Version
The QR size tier; Version 1 is 21×21 modules and each step adds four modules per side.
Format information
BCH-protected data identifying the error-correction level and selected mask.
Reed-Solomon
The error-correction algorithm that adds recoverable redundancy to QR codewords.
Static QR code
A symbol whose encoded payload remains fixed after creation.
Dynamic QR code
A symbol that encodes a redirect URL while its destination remains editable behind that redirect.
Related QR code resources
الأسئلة الشائعة
How are QR codes generated?
QR codes are generated by encoding input into bits, adding Reed-Solomon error correction codewords, placing data in a module matrix, applying a mask, inserting format and version information, and adding a quiet zone under ISO/IEC 18004.
What algorithm is used to generate QR codes?
QR generation follows ISO/IEC 18004. Its core algorithm includes data-mode selection, bit encoding, Reed-Solomon error correction, zigzag matrix placement, mask scoring, and format-information insertion.
How does a QR code generator turn a URL into a QR code?
A generator typically encodes an https URL in byte mode, selects a version from data length and error-correction level, constructs the module matrix, selects a mask, and exports the finished symbol.
What are QR code data modes?
Numeric, alphanumeric, byte, and Kanji modes define how characters convert to bits. Numeric is compact for digits, while byte mode handles URLs, mixed-case text, and arbitrary byte data.
When should I use byte mode versus alphanumeric mode?
Use byte mode for URLs, lowercase text, and special characters. Use alphanumeric mode only when the payload stays within its uppercase letters, digits, space, and limited-symbol set.
What is Reed-Solomon error correction in QR codes?
Reed-Solomon adds redundant codewords so a scanner can recover data when modules are damaged. Increasing from L through H generally increases recovery capacity while reducing data capacity for a version.
What are QR code mask patterns?
Eight mask patterns XOR with data modules to prevent large uniform regions and repeated structures. The generator scores each result and selects the lowest-penalty mask.
How many modules are in a QR code?
Module count depends on version. Version 1 is 21×21 modules, each version adds four modules per side, and Version 40 is 177×177 modules.
How is QR code version determined?
A generator selects the smallest version that fits the payload under the chosen data mode and error-correction level. More data or higher recovery requires more capacity.
Does generating a QR code require an internet connection?
No. Generation is local computation. Internet is only needed to use a cloud service or to access content at a URL encoded in the finished symbol.
What is the difference between generating and printing a QR code?
Generation creates a digital symbol; printing reproduces it on a physical surface. Final scan reliability depends on contrast, module size, quiet-zone preservation, and print quality.
Can I change a QR code after it is generated?
A static QR code has fixed encoded data. A dynamic QR code can keep its symbol while changing the destination behind its redirect URL; visual changes still require a safe re-export.
What is a quiet zone and why does it matter?
The quiet zone is a clear border of at least four modules around a QR symbol. Cropping it can prevent scanners from finding the symbol reliably.
What happens when you click Generate in QR-Build?
QR-Build processes the supplied content through the QR encoding pipeline, applies optional design treatments, and exports a scannable symbol. Dynamic QR workflows also register a redirect URL for later editing and analytics.
هل أنت مستعد لتحويل البيانات إلى رمز QR؟
استخدم QR-Build لإنشاء رمز QR قائم على المعايير، ثم تحقّق منه في البيئة التي سيمسحه فيها الناس.
أنشئ رمز QR باستخدام QR-Build