# spatie/image-optimizer

Easily optimize images using PHP

Repository: https://github.com/spatie/image-optimizer
Canonical: https://ross.abutalabs.com/products/image-optimizer
Homepage: https://freek.dev/797-easily-optimize-images-using-php-and-some-binaries
Language: PHP
License: MIT
License Family: permissive
Topics: php, image, optimizer, performance, jpeg, png, gif
Last push: 2026-06-29T08:28:57+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 90, release rhythm 58, longevity 100
- inputs: {"age_days": 3349, "days_push": 65, "days_rel": 65, "gap_med": 211, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2876, forks 225 (observed 2026-08-28T04:07:27.372871+00:00)

## What it is
A PHP library that optimizes PNG, JPG, WEBP, AVIF, SVG and GIF images by running them through a chain of installed optimization binaries like jpegoptim, pngquant, and gifsicle. It automatically detects available tools and overwrites images with smaller versions.

## Use cases
- compress images in a php application
- reduce image file sizes for faster page loads
- optimize uploaded images automatically
- shrink pngs and jpgs without losing visible quality
- batch optimize images in a laravel app
- optimize webp and avif images

## When to choose
- you're building in PHP and want lossless or near-lossless image compression
- you want a simple API that wraps multiple optimizer binaries
- you need to shrink images on upload or during deployment

## When to avoid
- you need pure-PHP optimization without external binaries installed
- you need advanced image manipulation like resizing or cropping
- you're not working in PHP

## Facets
- artifact type: library
- maturity: stable
- function: image-processing, compression, developer-tools
- domain: image-processing, web-development, performance, media
- platform: php, cli, cross-platform
- tags: image-optimization, php-package, jpegoptim, pngquant, webp, avif, svg, laravel-integration

## Member repositories
- spatie/image-optimizer (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:27.372871+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:35:42.703295+00:00, confidence not recorded.
  - readme: https://github.com/spatie/image-optimizer (fetched 2026-08-28T04:07:27.372871+00:00, sha 5bf395750b65)
  - homepage: https://freek.dev/797-easily-optimize-images-using-php-and-some-binaries (fetched 2026-08-29T09:51:15.344363+00:00, sha 74b45bd179e8)
  - site_page: https://freek.dev/about (fetched 2026-08-29T09:51:15.353744+00:00, sha e0ef9dccbb05)
- Data as of 2026-08-30T08:39:29.467469+00:00.
