Skip to content

perf: use libvips thumbnail for shrink-on-load - #21

Merged
constantgillet merged 1 commit into
mainfrom
perf/vips-shrink-on-load
Aug 6, 2026
Merged

perf: use libvips thumbnail for shrink-on-load#21
constantgillet merged 1 commit into
mainfrom
perf/vips-shrink-on-load

Conversation

@constantgillet

Copy link
Copy Markdown
Owner

Summary

  • Downscale via libvips thumbnail_buffer so large JPEG/WebP/HEIF masters are not fully decoded before resize.
  • Keep ImageKit-style cover fit (w+h) by thumbnail-to-fill then center-crop.
  • Header-only dimension checks before choosing the thumbnail path.

Test plan

  • cargo test (includes large JPEG downscale case)
  • Cold miss: large JPEG → small w transform; confirm correct dimensions
  • Cover crop w+h still center-fills
  • PNG downscale still works (no shrink-on-load, behavior unchanged)
  • Pass-through with no w/h unchanged

Downscale via thumbnail_buffer so large JPEG/WebP/HEIF masters are not
fully decoded before resize; cover crops keep center-fill behavior.
@constantgillet
constantgillet merged commit 9bb780e into main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant