description:Reduce image file size by quality level or to a target file size.
---
# Compress
Reduce image file size by specifying a quality level or a target file size in kilobytes. The tool uses iterative binary search to hit size targets accurately.
- In `quality` mode, lower values produce smaller files with more compression artifacts. A value of 80 is a good default for web use.
- In `targetSize` mode, the engine performs iterative compression to get as close to the target as possible without exceeding it.
- Output format matches the input format. The compression applies to the format's native encoding (e.g. JPEG quality for JPEG files, WebP quality for WebP files).
- If the default quality (80) is acceptable, you can omit the `quality` parameter entirely.