summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/dirty-scissors-fail.md5
-rw-r--r--packages/integrations/image/src/vendor/squoosh/impl.ts4
2 files changed, 9 insertions, 0 deletions
diff --git a/.changeset/dirty-scissors-fail.md b/.changeset/dirty-scissors-fail.md
new file mode 100644
index 000000000..0ec7f4cde
--- /dev/null
+++ b/.changeset/dirty-scissors-fail.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/image': minor
+---
+
+added a warning if the image was GIF
diff --git a/packages/integrations/image/src/vendor/squoosh/impl.ts b/packages/integrations/image/src/vendor/squoosh/impl.ts
index fa50c0fd9..3d01141d3 100644
--- a/packages/integrations/image/src/vendor/squoosh/impl.ts
+++ b/packages/integrations/image/src/vendor/squoosh/impl.ts
@@ -31,6 +31,10 @@ export async function decodeBuffer(
const firstChunkString = Array.from(firstChunk)
.map((v) => String.fromCodePoint(v))
.join('')
+ // TODO (future PR): support more formats
+ if (firstChunkString.includes('GIF')) {
+ throw Error(`GIF images are not supported, please install the @astrojs/image/sharp plugin`)
+ }
const key = Object.entries(supportedFormats).find(([, { detectors }]) =>
detectors.some((detector) => detector.exec(firstChunkString))
)?.[0] as EncoderKey | undefined