Generar código QR
qr-encodeCodifica un texto como código QR (ISO/IEC 18004, versiones 1 a 40, corrección L/M/Q/H, modo numérico, alfanumérico o bytes UTF-8) y devuelve la matriz de módulos y un SVG. Cuándo: hay que convertir bytes o texto a esta codificación, o desde ella, con exactitud y sin adivinar. No para: construir una URI data (data-uri-build). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Encodes text as a QR Code (ISO/IEC 18004, versions 1-40, error correction L/M/Q/H, numeric, alphanumeric or UTF-8 byte mode, automatic mask) and returns the module matrix and an SVG. Port of the Nayuki reference encoder; no image decoding. When: bytes or text have to be converted to or from this encoding exactly, without guessing. [EN completo / full EN: inputSchema.description]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ecc | No | Error correction level: L ~7 %, M ~15 %, Q ~25 %, H ~30 % of codewords recoverable (optional; one of: L, M, Q, H; default "M"). | M |
| dark | No | Dark module color (string; optional; default "#000000"; up to 7 chars; pattern ^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$). | #000000 |
| mask | No | Mask pattern 0-7, or -1 to choose by the ISO penalty rules (integer; optional; default -1; min -1; max 7). | |
| mode | No | Encoding mode; auto picks numeric, alphanumeric or byte for the whole text (optional; one of: auto, numeric, alphanumeric, byte; default "auto"). | auto |
| text | Yes | Text to encode (UTF-8 in byte mode; at most 2953 bytes at version 40-L) (string; required; up to 7089 chars). | |
| light | No | Light module color (string; optional; default "#ffffff"; up to 7 chars; pattern ^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$). | #ffffff |
| border | No | Quiet-zone width in modules for the SVG (the standard asks for 4) (integer; optional; default 4; min 0; max 16). | |
| boost_ecc | No | Raise the ECC level while the version does not grow (boolean; optional; default false). | |
| include_svg | No | Include the SVG string (boolean; optional; default true). | |
| max_version | No | Largest version allowed (integer; optional; default 40; min 1; max 40). | |
| min_version | No | Smallest version allowed (integer; optional; default 1; min 1; max 40). | |
| include_matrix | No | Include the module matrix (rows of "1" dark / "0" light) (boolean; optional; default true). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ecc | No | ||
| svg | No | ||
| mask | No | ||
| mode | No | ||
| size | No | ||
| modules | No | ||
| version | No | ||
| data_bytes | No |