Skip to content

Conversation

@alaycock
Copy link
Contributor

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.

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

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

Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will add significant build time for larger vaults.

@alaycock
Copy link
Contributor Author

alaycock commented Dec 7, 2025

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 }
}

@made-37
Copy link

made-37 commented Dec 12, 2025

This will add significant build time for larger vaults.

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

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.

3 participants