gatsby: Reduce default image thumbnail sizes and add option to set srcSetBreakpoints for gatsby-remark-images
Problem
We are running into memory issues generating thumbnails during our build, similar to the problems described in this issue. We have only ~150 or so images in our project, yet ~2,500 thumbnails are being generated during the build and causing a SIGSEGV error.
Cause
By default Gatsby generates 0.25x, 0.5x, 1x, 1.5x, 2x, and 3x sizes of thumbnails, which I feel is a little over the top. When you use GatsbyImageSharpFluid_withWebp
, sometimes you will get up to 28 thumbnails generated for every one image in your project!
Suggestion
gatsby-plugin-sharp
has a useful parameter on fluid called srcSetBreakpoints (described here) which lets you override these defaults, so you could pass in srcSetBreakpoints
and only generate three sizes (0.5x, 1x, and 2x), greatly reducing the number of thumbnails generated.
Unfortunately I can’t see any way to do this with gatsby-remark-images
, which is still generating a tonne of image thumbnails for every one image in our blog posts.
I suppose I have two feature requests:
- Simplify the default sizes set down from 6 sizes to 3 sizes.
- Update
gatsby-remark-images
to take asrcSetBreakpoints
option.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 23 (9 by maintainers)
Sir?
Talked with @tanaypratap and i’ve decided to take this on. New to Gatsby so might take few days to send out this PR. Please assign the issue to me.