| name | image-utils |
| description | Compress images with adjustable quality using the Caesium engine. Supports batch compression, overwrite or output to a custom folder.
|
| metadata | {"author":"EnconvoAI","version":"0.0.234"} |
API Reference
Just use the local_api tool to request these APIs.
| Endpoint | Description |
|---|
image-utils/image_compress | Compress images with adjustable quality using the Caesium engine. Supports batch compression, overwrite or output to a custom folder.. 10 params — use check_local_api_schemas tool |
Caesium Compression Engine (Preferred)
Caesium is a high-performance lossy/lossless image compression tool. Prefer Caesium over sips for compression, format conversion, resizing, and batch processing.
Installation
This project automatically downloads precompiled binaries from GitHub Releases. No Homebrew or compilation needed — takes just a few seconds.
Auto-install flow:
- Check local cache
~/.config/enconvo/bin/caesiumclt
- Check Homebrew paths (
/opt/homebrew/bin/, /usr/local/bin/)
- Check system PATH
- If not found anywhere, auto-download the latest tar.gz for the current architecture (ARM64/x86_64) from GitHub Releases and extract to
~/.config/enconvo/bin/
brew install caesiumclt
cargo install caesiumclt
winget install SaeraSoft.CaesiumCLT
curl -fsSL https://github.com/Lymphatus/caesium-clt/releases/latest/download/caesiumclt-v1.3.0-aarch64-apple-darwin.tar.gz | tar xz -C ~/.config/enconvo/bin/
Supported Formats
| Format | Lossy | Lossless |
|---|
| JPEG | MozJPEG | Yes |
| PNG | Yes | Yes (oxipng) |
| WebP | Yes | Yes |
| GIF | Yes | - |
Lossy Compression
caesiumclt -q 80 -o output/ image.jpg
caesiumclt -q 75 -o output/ image1.jpg image2.png image3.webp
caesiumclt -q 85 --suffix _compressed --same-folder-as-input image.jpg
Lossless Compression
caesiumclt --lossless -o output/ image.jpg
caesiumclt --lossless -e --keep-dates -o output/ image.jpg
caesiumclt --lossless -R -o output/ Pictures
caesiumclt --lossless -RS -o output/ Pictures
Format Conversion
caesiumclt -q 85 --format webp -o output/ Pictures/*.jpg
caesiumclt -q 100 --format jpeg -o output/ image.png
Resizing
caesiumclt --lossless --width 1920 -o output/ image.jpg
caesiumclt -q 90 --height 1080 -o output/ image.jpg
caesiumclt -q 85 --long-edge 1500 -o output/ Pictures/*.jpg
caesiumclt -q 85 --short-edge 800 -o output/ Pictures/*.jpg
Maximum File Size
caesiumclt --max-size 512000 -o output/ large-image.jpg
Batch & Recursive Processing
caesiumclt -q 80 -R -o output/ Pictures/
caesiumclt -q 80 -RS -o output/ Pictures/
caesiumclt -q 80 -RSO -o output/ Pictures/
caesiumclt -q 80 --threads 4 -R -o output/ Pictures/
caesiumclt -q 80 --dry-run -o output/ Pictures/
Overwrite Policies
caesiumclt -q 85 -O all -o output/ Pictures/*.jpg
caesiumclt -q 85 -O never -o output/ Pictures/*.jpg
caesiumclt -q 85 -O bigger -o output/ Pictures/*.jpg
Advanced Options
caesiumclt --lossless --png-opt-level 6 -o output/ image.png
caesiumclt -q 85 --jpeg-chroma-subsampling "4:2:0" --jpeg-baseline -o output/ image.jpg
caesiumclt -q 80 -e -o output/ image.jpg
caesiumclt -q 80 --keep-dates -o output/ image.jpg
caesiumclt -q 80 --suffix _small --same-folder-as-input image.jpg
Full Parameter Reference
| Parameter | Description |
|---|
-q <quality> | Compression quality 0-100 |
--lossless | Lossless compression mode |
--max-size <bytes> | Target maximum file size in bytes |
-o <dir> | Output directory |
--same-folder-as-input | Output to same folder as input file |
--suffix <str> | Custom suffix for output filenames |
--format <fmt> | Convert to format: jpeg, png, webp |
--width <px> | Resize width (maintains aspect ratio) |
--height <px> | Resize height (maintains aspect ratio) |
--long-edge <px> | Resize by longest edge |
--short-edge <px> | Resize by shortest edge |
-R | Recursive subdirectory processing |
-S | Preserve file directory structure |
-O <policy> | Overwrite policy: all, never, bigger |
-e | Preserve EXIF metadata |
--keep-dates | Preserve file timestamps |
--threads <n> | Number of parallel threads |
--dry-run | Test compression without writing files |
--png-opt-level <0-6> | PNG optimization level (higher = slower but smaller) |
--jpeg-chroma-subsampling <mode> | JPEG chroma subsampling: 4:4:4, 4:2:2, 4:2:0 |
--jpeg-baseline | Force baseline JPEG encoding |
Quality Guide
95-100: Near lossless, minimal size reduction. For professional photography, print originals.
80-95: Recommended range. Virtually indistinguishable, 60-80% file size reduction.
60-80: Noticeable compression. For web thumbnails and previews.
40-60: Visible quality loss. Only for extreme compression needs.
0-40: Severe distortion. Not recommended.
Engine Features
- JPEG: MozJPEG engine, 5-15% better compression than standard libjpeg
- PNG: oxipng engine, lossless compression with pixel-perfect output
- WebP: Both lossy and lossless supported
- GIF: Lossy compression supported
- Metadata: Optional EXIF and ICC color profile preservation
- Multithreaded: Configurable parallel processing for batch operations
- Dry run: Test compression results before writing files
macOS sips Best Practices
sips (Scriptable Image Processing System) is a built-in macOS command-line image processing tool. No installation required.
Format Conversion
sips -s format png input.jpg --out output.png
sips -s format jpeg input.heic --out output.jpg
sips -s format webp input.jpg --out output.webp
for f in *.heic; do sips -s format jpeg "$f" --out "${f%.heic}.jpg"; done
Resizing
sips -Z 1024 input.jpg --out resized.jpg
sips -z 600 800 input.jpg --out resized.jpg
W=$(sips -g pixelWidth input.jpg | tail -1 | awk '{print $2}')
H=$(sips -g pixelHeight input.jpg | tail -1 | awk '{print $2}')
sips -z $((H/2)) $((W/2)) input.jpg --out half.jpg
sips -c 600 800 input.jpg --out cropped.jpg
Quality & Compression
sips -s formatOptions 80 input.jpg --out output.jpg
sips -s formatOptions low input.jpg --out low.jpg
sips -s formatOptions high input.jpg --out high.jpg
Rotation & Flip
sips -r 90 input.jpg --out rotated.jpg
sips -r 180 input.jpg --out rotated.jpg
sips -f horizontal input.jpg --out flipped.jpg
sips -f vertical input.jpg --out flipped.jpg
Image Information
sips -g all input.jpg
sips -g pixelWidth -g pixelHeight input.jpg
sips -g format input.jpg
sips -g space input.jpg
sips -g dpiWidth -g dpiHeight input.jpg
sips -g hasAlpha input.jpg
DPI & Print
sips -s dpiWidth 300 -s dpiHeight 300 input.jpg --out print_ready.jpg
sips -s dpiWidth 72 -s dpiHeight 72 input.jpg --out screen.jpg
Color Space Management
sips -m "/System/Library/ColorSync/Profiles/sRGB Profile.icc" input.jpg
sips -m "/System/Library/ColorSync/Profiles/Display P3.icc" input.jpg
sips -m "/System/Library/ColorSync/Profiles/AdobeRGB1998.icc" input.jpg
Metadata Operations
mdls image.jpg
sips -g all image.jpg
sips -d GPSLatitude -d GPSLongitude image.jpg
Batch Processing
sips -s format png *.jpg --out ./png_output/
sips -Z 800 *.jpg --out ./thumbnails/
find . -name "*.heic" -exec sips -s format jpeg {} --out {}.jpg \;
Notes
- The
--out parameter requires the output directory to already exist
- Without
--out, sips modifies the original file in place
- HEIC is natively supported on macOS 10.13+, default iPhone photo format
- WebP requires macOS 11+, AVIF requires macOS 13+
- Color profiles are located at
/System/Library/ColorSync/Profiles/
- sips is the only option for: DPI control, color space management, HEIC decoding, and image info queries
Caesium vs sips
| Scenario | Recommended | Reason |
|---|
| Lossy compression | Caesium | MozJPEG engine, superior compression ratio |
| Lossless compression | Caesium | oxipng, better than sips |
| Format conversion | Caesium | Supports JPEG/PNG/WebP conversion with quality control |
| Resizing | Caesium | Long-edge/short-edge modes, combined with compression |
| Batch processing | Caesium | Multithreaded, recursive, structure preservation |
| Max file size targeting | Caesium | --max-size flag, sips cannot do this |
| HEIC decoding | sips | Caesium does not support HEIC input |
| DPI control | sips | Caesium does not modify DPI |
| Color space management | sips | Native macOS ColorSync support |
| Rotation / flip | sips | Caesium does not support rotation |
| Image info / metadata query | sips | Built-in, instant, no dependencies |