Convert, optimize, resize, thumbnail and analyze images through an API, or a CLI with zero binary dependencies. No ImageMagick, no libvips, no encoder builds.
$ cpx alias mathiasgrimm/glimpse-cli glimpse $ cpx glimpse convert banner.png --format=avif --optimize
✓ banner.avif written (image/avif) 360.3 KB → 24.2 KB
Optimize images after merging.
After each merge, get a PR with optimized images. Formats and filenames stay the same.
Set it up with cpx glimpse init --workflow-mode=optimize.
Want to keep an original? Comment glimpse skip on that image in the PR.
name: Automatic image optimization by Glimpse on: pull_request_target: types: [closed] pull_request_review_comment: types: [created] permissions: contents: write pull-requests: write # In Settings → Actions → General → Workflow permissions, enable # "Allow GitHub Actions to create and approve pull requests". jobs: optimize-images: if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true uses: mathiasgrimm/glimpse-cli/.github/workflows/optimize-images.yml@v1 secrets: GLIMPSE_TOKEN: ${{ secrets.GLIMPSE_TOKEN }} # Optional skip-image: if: github.event_name == 'pull_request_review_comment' && github.event.comment.body == 'glimpse skip' uses: mathiasgrimm/glimpse-cli/.github/workflows/skip-image.yml@v1
Glimpse starts checking and optimizing your images automatically.

Review the optimization PR before merging.

Compare the images and see the file size reduction.

You comment "glimpse skip" on the image to restore the original and skip it until its contents change.

Six reasons to put glimpse in your stack.
After you merge a PR, Glimpse automatically optimizes images that need it and opens a new PR for you to review.
Encoding runs on our side. The CLI needs nothing beyond PHP, so you get identical results on macOS, Linux and CI.
Ship AVIF and WebP without compiling libheif or aom. JPG, PNG and GIF come out of the same request.
analyze predicts the size of every output format before you commit, for one file or a whole directory.
Optimized output is never larger than the input, resize never upscales, and files are overwritten only when you request it.
One request in, one image out. Nothing is stored on our side and every request is authenticated with a bearer token.
Process images from your terminal.
glimpse is the CLI for converting, optimizing and resizing images. Run it with cpx and point it at your files. It handles image processing and saves the results for you.
$ cpx glimpse thumbnail photo.jpg --width=150 --quality=50 ✓ photo.thumb.jpg written (image/jpeg) $ cpx glimpse info photo.jpg --json | jq .format "jpg" $ cat photo.png | cpx glimpse convert - --format=avif -o photo.avif $ cpx glimpse thumbnail photo.jpg --output=- | imgcat
The same image tools, in your app.
Send a JSON body with the base64-encoded source and the target format. glimpse verifies the source type from the actual bytes, re-encodes it, and returns the result base64-encoded in data.output.data.
For PHP applications, use mathiasgrimm/glimpse-php. The official SDK provides one typed method per endpoint and handles base64 encoding and authentication for you.
// composer require mathiasgrimm/glimpse-php use MathiasGrimm\GlimpsePhp\Glimpse; $glimpse = Glimpse::createClient('YOUR_TOKEN'); $result = $glimpse->optimize(file_get_contents('photo.png')); file_put_contents('photo-optimized.png', $result->bytes);
See the savings before you touch a file.
cpx glimpse analyze predicts the converted size of every output format, for a single file or a whole directory tree, and shows you exactly where the savings are. Nothing is uploaded: your files never leave your machine.
--json for scripts, .glimpseignore to skip vendored assets $ cpx glimpse analyze assets/ --optimize banner.png 360.3 KB avif 40.5 KB -88.7% webp 81.1 KB -77.5% jpg 145.9 KB -59.5% hero.jpg 512.8 KB avif 61.5 KB -88.0% webp 98.3 KB -80.8%