-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to configure default image quality for ImageSharp queries #4873
Comments
If anyone is interested in doing this - this could be done by adding optional config paramater to |
Also, I think it would be a good idea to adjust that default value to a higher one (e.g. 92, like ImageMagick does so: "The default is to use the estimated quality of your input image if it can be determined, otherwise 92.") |
50 quality is often recommended as a good default as it's good enough quality while providing significant size savings. I agree that providing a way to override it globally for a project makes sense. |
ImageMagick has many other uses other than generating thumbnails for the web so its default isn't necessarily what you'd want for the web. |
@KyleAMathews Sounds fair, thank you for the explanation! |
If no one else is working on this then I'll snag it for Hacktoberfest. :) |
To be clear here, before I start in on the code, the goal is to be able to have an optional parameter for this plugin, like how gatsby-transformer-screenshot has this one: // in your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-transformer-screenshot`,
options: {
nodeTypes: [`StartersYaml`, `WhateverType`],
},
},
],
} Right? So, in this case the config would be: // in your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-transformer-sharp`,
options: {
quality: 92,
},
},
],
} |
Cool. Thanks! |
I'm super sorry, but I've been real busy with other stuff and traveling for work and never ended up having time to work on this. If anyone else wants to take it, go for it. Otherwise I'll see if I can get to it soon. :( |
I am happy to pick this one up :) |
I was looking to use the Otherwise would implementing a |
I could be completely wrong, so hopefully someone will add to this post.
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-images/src/index.js But you'll notice https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sharp/src/index.js So, I'm not sure what needs to be done to connect it all together to get the same thing in transformer-sharp, but hopefully I'm on the right track. Also, for what it's worth, I think a separate plugin just to set the default quality is overkill. That being said, I don't have knowledge of the inner workings of transformer-sharp or the cache util, so I could be totally wrong. |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
Currently, the default quality of ImageSharp-generated images are too low for most of the projects I participate in. I would like to configure a global default for ImageSharp query parameters, because it may become tedious to always specify
quality: 92
in every single image query.Issue #3837 is related, but it's about specifying a default locale for Moment.js date queries.
The text was updated successfully, but these errors were encountered: