export enum ColorSpace { UNKNOWN , GRAYSCALE , RGB , YCbCr , CMYK , YCCK } param { Buffer } data param { number } channels returns { boolean } export const isGrayscale = ( data , channels ) : boolean => { for ( let i = 0 ; i < data . length ; i += channels ) { for ( let j = 1 ; j < channels && i + j < data . length ; j += 1 ) { if ( data [ i ] !== data [ i + j ] ) { return false ; } } } return true ; } ;