From faad6e82dbb0990c6dc4262a142e48bfed6b6fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= Date: Sat, 22 Dec 2018 22:21:42 -0300 Subject: [PATCH] Fix defining Mask for grayscale transparent PNG files --- lib/image/png.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/image/png.js b/lib/image/png.js index 0e9acfb..0b60cfa 100644 --- a/lib/image/png.js +++ b/lib/image/png.js @@ -49,10 +49,10 @@ class PNGImage { // For PNG color types 0, 2 and 3, the transparency data is stored in // a dedicated PNG chunk. - if (this.image.transparency.grayscale) { + if (this.image.transparency.grayscale != null) { // Use Color Key Masking (spec section 4.8.5) // An array with N elements, where N is two times the number of color components. - const val = this.image.transparency.greyscale; + const val = this.image.transparency.grayscale; return this.obj.data['Mask'] = [val, val]; } else if (this.image.transparency.rgb) {