[gatsby-plugin-sharp] custom base64 width and height of 1px to get 'average color' placeholder #9857
Labels
stale?
Issue that may be closed soon due to the original author not responding any more.
Summary
Hello, I am using
gatsby-image
to display images from a WordPress source. I am trying to manipulate the base64 placeholder to display an 'average' color of the source image.Relevant information
My first idea was to request a base64 with a width and height of 1px, so that the image library reduces it to 1px of the average color. I think, at this time, there is no way to specify the size of the base64 generated when calling a fluid or fixed image fragment. It looks like it is set to a hardcoded 20px.
I found a workaround by requesting a image of 1px separate from my fluid/fixed image query.
My graphql query looks like this :
And when I call
gatsby-image
<Img/>
element, I add the src image of my 'placeholder' as the 'base64' key of my fluid image, like this :It works fine, but I would much prefer to have the option to specify parameters for the base64 to my fluid or fixed image fragemnt.
I am writing here in case I might be wrong and the option is already there. If not, and if the idea of having 'average color' placeholder sounds interesting or simply have the option of custom width or height, I would love to try and submit a PR.
Thanks!
The text was updated successfully, but these errors were encountered: