mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Renames 18 ambiguous or hard-to-search tool names so image tools self-qualify like the other modalities ("Compress" becomes "Compress Image"), and cleans up a few awkward names. Propagated across search (constants.ts), display (en.ts + 20 locales), the OpenAPI base spec + 20 locale specs, and the docs tool-page headings in 21 languages. Removes the duplicate "Normalize Audio" summary shared by the video and audio endpoints. Tool ids and routes are unchanged, so no API paths or bookmarks break.
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. | 2639f333073f | human | c8ad4d0044bd |
Konversi Gambar
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.