glimpse
API v1 and the CLI are live

Ship smaller images.
Skip the toolchain.

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

// continuous integration

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.

GitHub Actions workflow
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
  1. Your PR is merged

    Glimpse starts checking and optimizing your images automatically.

    A GitHub Actions linter check running on the optimization pull request
    Swipe to see the full image.Open full-size screenshot →
  2. Glimpse opens the optimization PR

    Review the optimization PR before merging.

    Glimpse opens an Optimize images pull request with instructions for keeping original images
    Swipe to see the full image.Open full-size screenshot →
  3. You review the image changes

    Compare the images and see the file size reduction.

    GitHub compares the original and optimized image in the Files changed tab
    Swipe to see the full image.Open full-size screenshot →
  4. You keep an original if needed

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

    A glimpse skip comment on a GitHub PR, followed by the bot confirmation and the restored original image
    Swipe to see the full image.Open full-size screenshot →

// why glimpse

Six reasons to put glimpse in your stack.

CI

Automatic image optimization

After you merge a PR, Glimpse automatically optimizes images that need it and opens a new PR for you to review.

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.

--

Safe by default

Optimized output is never larger than the input, resize never upscales, and files are overwritten only when you request it.

~

Stateless and private

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

// command line

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.

  • ✓ One command per job: convert, optimize, resize, thumbnail, info, analyze and check
  • ✓ Reads stdin, writes stdout, and keeps summaries on STDERR so pipes stay clean
bash
$ 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

// API and SDK

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.

  • ✓ 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

For PHP applications, use mathiasgrimm/glimpse-php. The official SDK provides one typed method per endpoint and handles base64 encoding and authentication for you.

optimize.php
// 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);

// know before you convert

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.

  • ✓ 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
$ 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%

// 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 generous free tier. Create an account, grab an API key and start shipping smaller images today.