ehowey / gatsby-theme-catalyst

An opinionated set of integrated themes and starters as a boilerplate to accelerate development with GatsbyJS
MIT License
163 stars 15 forks source link

(core): add imageQuality theme option #1128

Closed ehowey closed 3 years ago

ehowey commented 3 years ago

As identified by @wgx it is not easy to currently change the default image compression settings. This PR would introduce an imageQuality theme option that could be set on the core theme and would affect all images generated by gatsby-plugin-sharp and gatsby-remark-images.

@wgx Is this what you are looking for?

Fixes: https://github.com/ehowey/gatsby-theme-catalyst/issues/1127

wgx commented 3 years ago

@ehowey This is awesome! Really great, thank you.

I wonder if we could also switch the default to something higher-quality, to prevent beginners (like me) from getting caught out in future?

ehowey commented 3 years ago

I want to stick with 50 as that is the default from these plugins already. It would also potentially affect performance for existing websites, as it would upgrade all of their images. I have built quite a few projects so far and the image quality at 50 has been good enough.

I’ll do a bit more testing tonight and then merge it in.

Thanks for this issue - if you run into anything else let me know! On Jan 27, 2021, 1:17 AM -0700, Will Grant notifications@github.com, wrote:

@wgx commented on this pull request. In themes/gatsby-theme-catalyst-core/gatsby-config.js:

@@ -9,6 +9,8 @@ module.exports = (themeOptions) => { themeOptions.remarkImagesWidth == null ? 1440 : parseInt(themeOptions.remarkImagesWidth)

  • const imageQuality =
  • themeOptions.imageQuality == null ? 50 : parseInt(themeOptions.imageQuality) @ehowey Could the default be 80 ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.