From 92399ee5e25e571f0d11f13b3c169e1ecb794205 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 13 Dec 2021 18:26:35 +0000 Subject: [PATCH] Docs: correct gif resize example --- docs/api-output.md | 10 +++------- lib/output.js | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/docs/api-output.md b/docs/api-output.md index 495437f4..c25aca90 100644 --- a/docs/api-output.md +++ b/docs/api-output.md @@ -341,13 +341,9 @@ await sharp('animated.webp', { animated: true }) ``` ```javascript -// Create 128x128, non-dithered thumbnail of an animated GIF -const { pages } = await sharp('animated.gif').metadata(); -const gif = await sharp('animated.gif', { animated: true }) - .resize({ - width: 128, - height: 128 * pages - }) +// Create a 128x128, cropped, non-dithered, animated thumbnail of an animated GIF +const out = await sharp('in.gif', { animated: true }) + .resize({ width: 128, height: 128 }) .gif({ dither: 0 }) .toBuffer(); ``` diff --git a/lib/output.js b/lib/output.js index 7f041417..cb7e451a 100644 --- a/lib/output.js +++ b/lib/output.js @@ -521,13 +521,9 @@ function webp (options) { * .toFile('animated.gif'); * * @example - * // Create 128x128, non-dithered thumbnail of an animated GIF - * const { pages } = await sharp('animated.gif').metadata(); - * const gif = await sharp('animated.gif', { animated: true }) - * .resize({ - * width: 128, - * height: 128 * pages - * }) + * // Create a 128x128, cropped, non-dithered, animated thumbnail of an animated GIF + * const out = await sharp('in.gif', { animated: true }) + * .resize({ width: 128, height: 128 }) * .gif({ dither: 0 }) * .toBuffer(); *