Files
SnapOtter/apps/docs/de/tools/image/compress.md
T
SnapOtterandGitHub f858c4cea0 feat: clearer, disambiguated tool names across all surfaces (#520)
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.
2026-07-15 21:55:51 +08:00

2.4 KiB

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
Verringert die Dateigröße eines Bildes über eine Qualitätsstufe oder auf eine Zieldateigröße. 342c5cf1f864 human f52fc9641e64

Bild komprimieren

Verringert die Dateigröße eines Bildes durch Angabe einer Qualitätsstufe oder einer Zieldateigröße in Kilobyte. Das Werkzeug verwendet eine iterative binäre Suche, um Größenvorgaben präzise zu treffen.

API-Endpunkt

POST /api/v1/tools/image/compress

Akzeptiert Multipart-Formulardaten mit einer Bilddatei und einem JSON-Feld settings.

Parameter

Parameter Typ Erforderlich Standard Beschreibung
mode string Nein "quality" Komprimierungsmodus: quality oder targetSize
quality number Nein 80 Qualitätsstufe (1-100). Wird verwendet, wenn der Modus quality ist.
targetSizeKb number Nein - Zieldateigröße in Kilobyte. Wird verwendet, wenn der Modus targetSize ist.

Beispielanfrage

Auf Qualität 60 komprimieren:

curl -X POST http://localhost:1349/api/v1/tools/image/compress \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"mode": "quality", "quality": 60}'

Auf eine Zielgröße von 200 KB komprimieren:

curl -X POST http://localhost:1349/api/v1/tools/image/compress \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"mode": "targetSize", "targetSizeKb": 200}'

Beispielantwort

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.jpg",
  "originalSize": 2450000,
  "processedSize": 204800
}

Hinweise

  • Im Modus quality erzeugen niedrigere Werte kleinere Dateien mit mehr Komprimierungsartefakten. Ein Wert von 80 ist ein guter Standard für die Webnutzung.
  • Im Modus targetSize führt die Engine eine iterative Komprimierung durch, um so nah wie möglich an das Ziel zu kommen, ohne es zu überschreiten.
  • Das Ausgabeformat entspricht dem Eingabeformat. Die Komprimierung wird auf die native Kodierung des Formats angewendet (z. B. JPEG-Qualität für JPEG-Dateien, WebP-Qualität für WebP-Dateien).
  • Wenn die Standardqualität (80) akzeptabel ist, können Sie den Parameter quality ganz weglassen.