From 77e62e767cd1621f1633ce8f80799c5daca50b46 Mon Sep 17 00:00:00 2001 From: David Vaness Date: Fri, 23 Aug 2024 12:09:15 +0200 Subject: [PATCH] fix(types): update Channels type This PR adds 1 and 2 as possible values 1: The image has only one channel representing grayscale values. Each pixel is stored as a single intensity value, ranging from black to white. 2: The image could have one channel for grayscale intensity and another channel for alpha (transparency). This is similar to an RGBA image but without the color information, only grayscale (intensity) and alpha. Possibly there are other reasons for a 2 channel Image but this is the most common one in my experience --- lib/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 7fba55f78..fae348879 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1441,8 +1441,8 @@ declare namespace sharp { depth?: 'char' | 'uchar' | 'short' | 'ushort' | 'int' | 'uint' | 'float' | 'complex' | 'double' | 'dpcomplex'; } - /** 3 for sRGB, 4 for CMYK */ - type Channels = 3 | 4; + /** 1 for grayscale, 2 for grayscale + alpha, 3 for sRGB, 4 for CMYK or RGBA */ + type Channels = 1 | 2 | 3 | 4; interface RGBA { r?: number | undefined;