mathiasgrimm / glimpse-cli
Convert, optimize, resize, thumbnail and analyze images from your terminal. The first-party CLI for glimpseimg.com, the image API for developers.
Requires
- php: ^8.2
Requires (Dev)
- illuminate/http: ^12.17
- laravel-zero/framework: ^12.0.2
- laravel-zero/phar-updater: ^1.4
- laravel/pint: ^1.29
- mathiasgrimm/glimpse-php: ^3.0
- mockery/mockery: ^1.6.12
- pestphp/pest: ^3.8.4|^4.1.2
- phpstan/phpstan: ^2.2
- symfony/finder: ^7.2
Suggests
- ext-gd: Far tighter size estimates for the analyze command when Imagick is unavailable
- ext-imagick: Far tighter size estimates, plus AVIF and CMYK support, for the analyze command
This package is auto-updated.
Last update: 2026-07-22 13:32:50 UTC
README
Ship smaller images. Skip the toolchain.
Convert, optimize, resize, thumbnail and analyze images from your terminal.
The first-party CLI for glimpseimg.com, the image API for developers.
Shipping images means wrangling ImageMagick, libvips, mozjpeg, cwebp and avifenc: compiled binaries that differ between your laptop, your teammate's laptop, and CI. glimpse replaces all of them with one command, with zero binary dependencies. The heavy lifting happens on the Glimpse API: stateless, nothing stored, your bytes never linger. You install a single CLI and go:
composer global require mathiasgrimm/glimpse-cli glimpse auth glimpse convert banner.png --format=avif
Wrote banner.avif (image/avif, 24.2 KB, 3200x840)
That's a real session: banner.png is a frame of the banner at the top of this page, re-encoded from 360.3 KB down to 24.2 KB. The banner you are actually looking at goes one step further; it is a two-frame animated AVIF (watch the green dot blink) that glimpse converted from a GIF, 40.1 KB in total. Want to know what a conversion will buy you before you convert? glimpse analyze predicts the output size for every format without uploading your image:
Run glimpse with no arguments to see everything it can do:
Documentation
The full documentation lives at glimpseimg.com/docs/cli:
- Installation: Composer, the standalone PHAR, and
self-update. - Authentication:
glimpse authand the environment variables. - Commands: convert, optimize, resize, thumbnail, analyze, info, and usage.
- Project files:
glimpse init,glimpse check,.glimpseignore, and the baseline. - Continuous integration: the scaffolded GitHub Actions workflow.
- Scripting: stdin, stdout,
--json, and clean pipes.
Adding glimpse to an existing project? Follow Add Glimpse to Your Project; it goes from install to a CI gate in about ten minutes.
This repository runs the same gate on itself: see .github/workflows/images.yml.
Development
composer test # Pint (check), PHPStan, and the Pest suite
Releasing
make release VERSION=vX.Y.Z
This runs the test suite, compiles the PHAR, commits builds/glimpse, pushes, and creates the GitHub release with the binary attached, the equivalent of:
php glimpse app:build glimpse --build-version=vX.Y.Z git add builds/glimpse && git commit -m "Build vX.Y.Z" && git push gh release create vX.Y.Z builds/glimpse --title vX.Y.Z --generate-notes
self-update discovers versions through Packagist and downloads the glimpse PHAR attached to the GitHub release of the matching tag, so the release must carry the binary as an asset under exactly that name. Committing the fresh build keeps composer global require working (composer's bin points at builds/glimpse) and lets pre-0.1.1 installs, which download builds/glimpse from the tag itself, still update.
The --build-version must be the tag name verbatim, including the v prefix. The updater compares the embedded build version against the Packagist tag as plain strings, so a build stamped 0.1.0 never equals the tag v0.1.0 and self-update would keep re-downloading the release it is already running.
License
glimpse-cli is open-source software licensed under the MIT license.
Every image on this page was converted by glimpse itself, including the animated banner (GIF in, animated AVIF out).
Grab a free API key at glimpseimg.com (Settings → API Tokens).


