mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
3.2 KiB
3.2 KiB
description, i18n_source_hash, i18n_provenance, i18n_output_hash
| description | i18n_source_hash | i18n_provenance | i18n_output_hash |
|---|---|---|---|
| Buat kode QR dengan warna kustom dan tingkat koreksi kesalahan. | 096ef4d90da5 | human | f2de527b0127 |
QR Code Generator
Buat gambar kode QR dari teks atau URL dengan ukuran, tingkat koreksi kesalahan, dan warna latar depan/latar belakang kustom yang dapat dikonfigurasi.
API Endpoint
POST /api/v1/tools/image/qr-generate
Menerima JSON body (bukan multipart). Tidak perlu unggah berkas.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| text | string | Yes | - | Konten yang di-encode dalam kode QR (1 hingga 2000 karakter) |
| size | number | No | 400 |
Lebar/tinggi gambar output dalam piksel (100 hingga 10000) |
| errorCorrection | string | No | "M" |
Tingkat koreksi kesalahan: L (7%), M (15%), Q (25%), H (30%) |
| foreground | string | No | "#000000" |
Warna latar depan/modul kode QR dalam hex (#RRGGBB) |
| background | string | No | "#FFFFFF" |
Warna latar belakang kode QR dalam hex (#RRGGBB) |
| logoDataUri | string | No | - | Gambar logo sebagai data URI (data:image/png;base64,... atau data:image/jpeg;base64,..., maks 700 KB). Diposisikan di tengah kode QR pada 22% dari ukuran QR. Memaksa koreksi kesalahan ke H |
Error Correction Levels
| Level | Recovery | Use Case |
|---|---|---|
L |
~7% | Kepadatan data maksimum |
M |
~15% | Seimbang (default) |
Q |
~25% | Baik untuk kode cetak |
H |
~30% | Terbaik untuk kode dengan overlay logo |
Example Request
curl -X POST http://localhost:1349/api/v1/tools/image/qr-generate \
-H "Authorization: Bearer si_your-api-key" \
-H "Content-Type: application/json" \
-d '{"text": "https://snapotter.com", "size": 500, "errorCorrection": "H"}'
Kode QR bermerek dengan warna kustom:
curl -X POST http://localhost:1349/api/v1/tools/image/qr-generate \
-H "Authorization: Bearer si_your-api-key" \
-H "Content-Type: application/json" \
-d '{"text": "Hello World", "size": 300, "foreground": "#1a365d", "background": "#f7fafc"}'
Example Response
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/qrcode.png",
"originalSize": 0,
"processedSize": 4520
}
Notes
- Endpoint ini menerima JSON, bukan multipart form data, karena tidak perlu unggah gambar.
- Output selalu berupa gambar PNG.
- Nama berkas output selalu
qrcode.png. originalSizeselalu 0 karena alat ini menghasilkan gambar dari awal.- Zona sunyi 2 modul (margin) disertakan di sekitar kode QR.
- Panjang teks maksimum adalah 2000 karakter. Kapasitas sebenarnya bergantung pada tingkat koreksi kesalahan dan enkode karakter.
- Tingkat koreksi kesalahan yang lebih tinggi memungkinkan kode QR tetap dapat dipindai meskipun sebagian tertutup, tetapi mengurangi kapasitas data.
- Saat
logoDataUridisediakan, koreksi kesalahan secara otomatis dipaksa keH(30%) agar kode QR tetap dapat dipindai meskipun logo menutupi bagian tengah.