gatsby-plugin-sharp | Support withoutEnlargement
See original GitHub issueSummary
The Sharp resize() function has a useful option: withoutEnlargement that can be used to prevent source images from being enlarged beyond their original size, which helps prevent undesirable degradation in image quality. It would be nice if Gatsby Plugin Sharp exposed this option as a Shared Option.
Basic example
childImageSharp{
fixed(
width: 1000
height: 600
withoutEnlargement: true
){
...GatsbyImageSharpFixed
}
}
childImageSharp{
fluid(
maxWidth: 1000
maxHeight: 600
withoutEnlargement: true
){
...GatsbyImageSharpFluid
}
}
childImageSharp{
resize(
width: 1000
height: 600
withoutEnlargement: true
){
...GatsbyImageSharpResize
}
}
Motivation
There are use cases where it is desirable to limit the resizing of an image to sizes that are <= its original size, in order to prevent loss in image quality. The withoutEnlargement option allows you to enforce this restriction. It would be great if Gatsby’s Sharp plugin exposed this functionality.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
gatsby-plugin-sharp
Exposes several image processing functions built on the Sharp image processing library. This is a low-level helper plugin generally used by other Gatsby...
Read more >[gatsby-plugin-sharp] Support Default Configuration #5531
Summary At present there is no way to define default configuration for images used on a Gatsby site. The only option is to...
Read more >gatsby-plugin-sharp | Yarn - Package Manager
Exposes several image processing functions built on the Sharp image processing library. This is a low-level helper plugin generally used by other Gatsby...
Read more >"Gatsby-plugin-sharp wasn't setup correctly in gatsby-config.js ...
Got the same error message but from Netlify build log. Was able to resolve by updating to latest version: npm install ...
Read more >Images in Gatsby Using gatsby-image & gatsby-plugin-sharp
If you've enjoyed this tutorial and our broader community, consider checking out our DigitalOcean products which can also help you achieve your ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s still in beta, but should be stable next month
Thank you, I’ll take a look at the new resolver