quartz icon indicating copy to clipboard operation
quartz copied to clipboard

feat: add compression and resizing for image assets

Open alaycock opened this issue 1 month ago • 2 comments

Add compression and resizing to image assets. The Assets plugin now accepts two new arguments compressImages and resizeImages. The former enables compression for image assets through Sharp, an existing dependency. The second allows for global resizing of images.

The intention is to provide a mechanism with coarse options and sensible defaults, allowing Quartz sites to load faster without additional configuration.

The default value of resizeImages is 2x the default content width of 850px, ensuring that images don't lose fidelity on high DPI screens. No default maximum height is set to ensure that full-page length images (eg, infographics) are rendered as they would be in Obsidian.

alaycock avatar Nov 21 '25 19:11 alaycock

built with Refined Cloudflare Pages Action

âš¡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview 6d8ecd33fad4c1fdf53ea02af8d64f12d43145d9

github-actions[bot] avatar Nov 21 '25 19:11 github-actions[bot]

That's true, but that's also true for ogImages and the docs just suggests turning it off for local dev. Maybe I could add a similar note to the docs.

I suspect most folks don't manually optimize their images for the web, which makes compressImages: true a sane default. Resizing and compression is configurable and can be turned off via compressImages: false.

If this is being considered for merging I might tweak the options. Maybe it would be more clear as:

{
  optimizeImages: 'off' | 'compress' | { width?: number; height?: number; fit: keyof FitEnum }
}

alaycock avatar Dec 07 '25 17:12 alaycock

This will add significant build time for larger vaults.

The current PR runs single-threaded, right? This could be an area for speed-up.

made-37 avatar Dec 12 '25 16:12 made-37