glimpse
API v1 and the CLI are live

Ship smaller images.
Skip the toolchain.

Convert, optimize, resize, thumbnail and analyze images through one authenticated JSON API, or a CLI with zero binary dependencies. No ImageMagick, no libvips, no encoder builds.

No credit card required to start.

bash
$ composer global require mathiasgrimm/glimpse-cli
$ glimpse auth
$ glimpse convert banner.png --format=avif --optimize
 banner.avif written (image/avif) 360.3 KB → 24.2 KB

// why glimpse

Six reasons to put glimpse in your stack.

0x

Zero binaries to babysit

Encoding runs on our side. The CLI needs nothing beyond PHP, so you get identical results on macOS, Linux and CI.

AV1

AVIF without the fight

Ship AVIF and WebP without compiling libheif or aom. JPG, PNG and GIF come out of the same request.

~%

Know before you convert

analyze predicts the size of every output format before you commit, for one file or a whole directory.

CI

A CI gate for images

check fails the build when an image would shrink past your threshold, so bloat never reaches production.

--

Safe by default

Optimized output is never larger than the input, resize never upscales, and nothing is overwritten without --force.

~

Stateless and private

One request in, one image out. Nothing is stored on our side and every request is authenticated with a bearer token.

// the whole integration

One JSON request. Copy, paste, ship.

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.

  • Six endpoints under /api/v1: convert, optimize, resize, thumbnail, info and analyze
  • Inputs up to 15 MB, verified from the decoded bytes, not a filename
  • Returns format, MIME type, size and dimensions with every result

Or skip the plumbing entirely: mathiasgrimm/glimpse-php is the official PHP SDK. One typed method per endpoint, with the base64 encoding and authentication handled for you.

convert.php
// composer require mathiasgrimm/glimpse-php

use MathiasGrimm\GlimpsePhp\Client;
use MathiasGrimm\GlimpsePhp\ImageFormat;
use Illuminate\Http\Client\Factory;

$glimpse = new Client(new Factory, getenv('GLIMPSE_TOKEN'));

$result = $glimpse->convert(
    file_get_contents('photo.png'),
    ImageFormat::Avif,
    optimize: true,
);

file_put_contents('photo.avif', $result->bytes);

// command line

The same API, from your terminal.

glimpse is the first-party CLI, available on GitHub as mathiasgrimm/glimpse-cli. A self-updating PHAR with zero binary dependencies: it handles file reading, base64 encoding, authentication and output files for you.

  • One command per job: convert, optimize, resize, thumbnail, info, analyze and check
  • Authenticate once with glimpse auth, then point it at files
  • Reads stdin, writes stdout, and keeps summaries on STDERR so pipes stay clean
bash
$ glimpse thumbnail photo.jpg --width=150 --quality=50
 photo.thumb.jpg written (image/jpeg)
$ glimpse info photo.jpg --json | jq .format
"jpg"
$ cat photo.png | glimpse convert - --format=avif -o photo.avif
$ glimpse thumbnail photo.jpg --output=- | imgcat

Composer

One package, no extensions to compile.

$ composer global require \
mathiasgrimm/glimpse-cli

Standalone PHAR

A single self-contained binary. No Composer needed.

$ curl -Lo /usr/local/bin/glimpse \
https://github.com/mathiasgrimm/glimpse-cli/releases/latest/download/glimpse
$ chmod +x /usr/local/bin/glimpse

Stay current

The PHAR updates itself in place.

$ glimpse self-update

// know before you convert

See the savings before you touch a file.

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.

  • Estimates locally, so originals stay on your disk
  • Scans directories recursively and reports per-format savings
  • Green means 25% or more saved; regressions are called out in red
  • --json for scripts, .glimpseignore to skip vendored assets
bash
$ 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%

// continuous integration

Fail the build, not your users.

glimpse check scans a directory and exits non-zero when any image would shrink past your threshold. Wire it into GitHub Actions and unoptimized images never merge again.

  • Exits 1 when optimization gains exceed the threshold (default 10%)
  • Tune how strict the gate is with --threshold=25
  • .glimpseignore keeps vendored and generated assets out of the scan
.github/workflows/glimpse.yml
name: Glimpse

on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read

jobs:
  check-images:
    runs-on: ubuntu-latest
    env:
      # Optional. Without it (for example on fork pull requests, which
      # never receive secrets) the CLI uses its built-in public token,
      # which only allows check and analyze and shares rate limits.
      GLIMPSE_TOKEN: ${{ secrets.GLIMPSE_TOKEN }}
    steps:
      - uses: actions/checkout@v6
      - name: Install glimpse
        run: |
          composer global require --no-interaction --no-progress mathiasgrimm/glimpse-cli
          composer global config bin-dir --absolute --quiet >> "$GITHUB_PATH"
      - name: Check images
        run: glimpse check .

// pricing

Coming soon

Pricing is on the way. A free tier is here to stay.

glimpse is free while we finish billing, and there will always be a free tier. Create an account, grab an API key and start shipping smaller images today.