birkir / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
137 stars 75 forks source link

[Feature Request] Offer way to disable Prismic's default image compression. #177

Closed bit-marcink closed 4 years ago

bit-marcink commented 4 years ago

Prismic default compression of images is way too agressive for some use cases, especially that those images are resized and recompressed by gatsby-image (where we have more control).

At the moment some images (especially pngs with blurred background and transparency) look really bad.

This could be done either by a simple boolean in plugin options to disable (remove the auto=compress,format parameters from the url of the image or the same way crop is implemented in the query directly.

madeleineostoja commented 4 years ago

This is really badly effecting all our projects, and we're considering moving away from Prismic to Sanity just because of it. Prismic's default image compression completely destroys our PNG assets and makes them unuseable in production.

Any update on whether this could be addressed? I can confirm that just removing the auto=compress flag fixes the quality for us.


Edit: I've contacted Prismic's support about it, and they confirmed there's no way to disable within Prismic itself. The recommended solution is editing the url strings like @bit-marcink is suggesting.

madeleineostoja commented 4 years ago

Happy to attempt a PR, had a quick skim through and it looks like it'd just be a matter of regexing the compress param out of the URL here? https://github.com/birkir/gatsby-source-prismic-graphql/blob/08609fc3b066850ccd93a019e16114a27dd8d636/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts#L288

And for what it's worth I'd vote for a global plugin option, vs query-level config. I think that makes much more sense for a thing like this.