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.
2.9 KiB
2.9 KiB
description, i18n_source_hash, i18n_provenance, i18n_output_hash
| description | i18n_source_hash | i18n_provenance | i18n_output_hash |
|---|---|---|---|
| Konversi gambar antar format termasuk format modern seperti AVIF, JXL, dan HEIC. | 562f8270e8c3 | human | c8ad4d0044bd |
Konversi
Konversi gambar antar format. Mendukung format web umum serta format khusus seperti HEIC, JXL, BMP, ICO, JP2, QOI, dan PSD.
API Endpoint
POST /api/v1/tools/image/convert
Menerima data formulir multipart dengan file gambar dan field JSON settings.
Parameter
| Parameter | Tipe | Wajib | Default | Deskripsi |
|---|---|---|---|---|
| format | string | Ya | - | Format target: jpg, png, webp, avif, tiff, gif, heic, heif, jxl, bmp, ico, jp2, qoi, psd, ppm, eps, tga |
| quality | number | Tidak | - | Kualitas output (1-100). Berlaku untuk format lossy seperti jpg, webp, avif, heic. |
Format Output yang Didukung
| Format | Tipe | Catatan |
|---|---|---|
| jpg | Lossy | JPEG, kompatibilitas terbaik |
| png | Lossless | Mendukung transparansi |
| webp | Keduanya | Format web modern, kompresi baik |
| avif | Lossy | Format generasi baru, kompresi sangat baik |
| tiff | Keduanya | Alur kerja cetak/penerbitan |
| gif | Lossless | Terbatas hingga 256 warna |
| heic / heif | Lossy | Format ekosistem Apple |
| jxl | Keduanya | JPEG XL, format generasi baru |
| bmp | Lossless | Bitmap tanpa kompresi |
| ico | Lossless | Format ikon Windows |
| jp2 | Lossy | JPEG 2000 |
| qoi | Lossless | Format Quite OK Image |
| psd | Berlapis | Adobe Photoshop (memerlukan ImageMagick) |
| ppm | Lossless | Portable Pixmap (PPM/PGM/PBM) |
| eps | Vektor | Encapsulated PostScript |
| tga | Lossless | Format gambar Targa |
Contoh Permintaan
Konversi ke WebP:
curl -X POST http://localhost:1349/api/v1/tools/image/convert \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@photo.jpg" \
-F 'settings={"format": "webp", "quality": 85}'
Konversi ke PNG (lossless):
curl -X POST http://localhost:1349/api/v1/tools/image/convert \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@photo.jpg" \
-F 'settings={"format": "png"}'
Contoh Respons
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.webp",
"originalSize": 2450000,
"processedSize": 680000
}
Catatan
- Ekstensi nama file output diperbarui otomatis agar sesuai dengan format target.
- Input SVG dirasterisasi pada 300 DPI sebelum konversi.
- Konversi PSD memerlukan ImageMagick terpasang di server.
- BMP, EPS, ICO, JP2, JXL, PPM, QOI, dan TGA menggunakan encoder CLI khusus dan melewati pemrosesan Sharp.
- Encoding HEIC/HEIF menggunakan pustaka encoder HEIC sistem.
- Format input beragam: JPEG, PNG, WebP, AVIF, TIFF, GIF, HEIC, RAW (CR2, NEF, ARW, dll.), PSD, SVG, BMP, dan lainnya.