You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: responsive image delivery with multi-size PNG + WebP (#5192)
## Summary
- Replace single `plot_thumb.png` with responsive multi-size PNG + WebP
variants (400/800/1200px) for all plot images
- Frontend `<picture>` elements with `srcSet` + `sizes` let the browser
pick optimal size based on viewport and DPR
- Remove `preview_thumb` field from API, database sync, metadata
templates, and all documentation
- Graceful fallback to `plot.png` during migration (before backfill
runs)
### Image savings (scatter-basic/matplotlib example)
| Variant | Size | vs original |
|---------|------|-------------|
| plot.png (original) | 477K | baseline |
| plot_800.webp (typical mobile) | 18K | **-96%** |
| plot_400.webp (small mobile) | 7.2K | **-98%** |
### Changes (33 files)
- **Backend**: `create_responsive_variants()` in `core/images.py`
generates all 7 variants
- **Frontend**: `<picture>` + `srcSet` in ImageCard, SpecDetailView,
SpecOverview, CatalogPage
- **Workflows**: `impl-generate.yml` and `impl-repair.yml` generate +
upload all variants
- **API**: Removed `preview_thumb`/`thumb` from schemas, routers, MCP
server
- **Scripts**: `backfill_responsive_images.py` for historical plots,
`remove_preview_thumb_from_yaml.py` for YAML cleanup
### Post-merge steps
1. Run `python scripts/backfill_responsive_images.py` to generate
variants for ~2,668 existing images (~2h)
2. Run `python scripts/remove_preview_thumb_from_yaml.py` → commit YAML
cleanup separately
3. Later: Alembic migration to drop `preview_thumb` DB column
Closes#5191
## Test plan
- [x] 1061 unit tests pass
- [x] Frontend builds successfully
- [x] Ruff lint + format clean
- [x] Local test: responsive variants generated with correct sizes
- [ ] Deploy and verify fallback to plot.png for historical images
- [ ] Run backfill script on production GCS
- [ ] Trigger impl-generate for one spec to verify new workflow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments