diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on 1027x768.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on 1027x768.snap.png index a7e39a84f91f8..62277b6e35c0c 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on 1027x768.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on 1027x768.snap.png differ diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on ipad-2.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on ipad-2.snap.png index d4037fa022037..62277b6e35c0c 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on ipad-2.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on ipad-2.snap.png differ diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on iphone-6.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on iphone-6.snap.png index a616c05413f0a..2892c8a6aaa45 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on iphone-6.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image -- renders correctly on iphone-6.snap.png differ diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on 1027x768.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on 1027x768.snap.png index 9a3de2a25400a..eb07fafb811b1 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on 1027x768.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on 1027x768.snap.png differ diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on ipad-2.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on ipad-2.snap.png index 9a3de2a25400a..ab2dc1d8e7caa 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on ipad-2.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on ipad-2.snap.png differ diff --git a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on iphone-6.snap.png b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on iphone-6.snap.png index 5c7c5b17a936d..d43a628d67758 100644 Binary files a/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on iphone-6.snap.png and b/e2e-tests/visual-regression/cypress/snapshots/image.js/StaticImage -- fixed image smaller than requested size -- renders correctly on iphone-6.snap.png differ diff --git a/packages/gatsby-plugin-image/src/babel-helpers.ts b/packages/gatsby-plugin-image/src/babel-helpers.ts index fbbc8101cab26..246ad15097b29 100644 --- a/packages/gatsby-plugin-image/src/babel-helpers.ts +++ b/packages/gatsby-plugin-image/src/babel-helpers.ts @@ -6,6 +6,7 @@ import { getAttributeValues } from "babel-jsx-utils" export const SHARP_ATTRIBUTES = new Set([ `src`, `layout`, + `formats`, `maxWidth`, `maxHeight`, `quality`, diff --git a/packages/gatsby-plugin-sharp/src/image-data.ts b/packages/gatsby-plugin-sharp/src/image-data.ts index be22c4f926929..ad90dc1125783 100644 --- a/packages/gatsby-plugin-sharp/src/image-data.ts +++ b/packages/gatsby-plugin-sharp/src/image-data.ts @@ -108,6 +108,7 @@ export async function generateImageData({ tracedSVGOptions = {}, transformOptions = {}, quality, + formats: rawFormats = [`auto`, `webp`], } = args const { @@ -117,7 +118,7 @@ export async function generateImageData({ const metadata = await getImageMetadata(file, placeholder === `dominantColor`) - const formats = new Set(args.formats) + const formats = new Set(rawFormats) let useAuto = formats.has(``) || formats.has(`auto`) || formats.size === 0 if (formats.has(`jpg`) && formats.has(`png`)) {