about summary refs log tree commit diff
path: root/converter/other/pamtopng.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-05-15 15:56:45 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-05-15 15:56:45 +0000
commit3f8fafb766a7042d5a10b9ae825f3bc9214024fd (patch)
treed2fbccb9565d4b632c2ffc20b0198ee7a3c59131 /converter/other/pamtopng.c
parentd719cdb1a3d4bbc210408a213b396970d66bc1b2 (diff)
downloadnetpbm-mirror-3f8fafb766a7042d5a10b9ae825f3bc9214024fd.tar.gz
netpbm-mirror-3f8fafb766a7042d5a10b9ae825f3bc9214024fd.tar.xz
netpbm-mirror-3f8fafb766a7042d5a10b9ae825f3bc9214024fd.zip
Release 10.86.22
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4107 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pamtopng.c')
-rw-r--r--converter/other/pamtopng.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c
index a323844f..761d303d 100644
--- a/converter/other/pamtopng.c
+++ b/converter/other/pamtopng.c
@@ -287,7 +287,17 @@ colorTypeFromInputType(const struct pam * const pamP) {
             pm_error("Input tuple type is GRAYSCALE, "
                      "but number of planes is %u instead of 1",
                      pamP->depth);
-    } else if (strneq(pamP->tuple_type, "BLACKANDWHITE", 3)) {
+     } else if (strneq(pamP->tuple_type, "BLACKANDWHITE_ALPHA", 19)) {
+        if (pamP->depth != 2)
+            pm_error("Input tuple type is BLACKANDWHITE_ALPHA, "
+                     "but number of planes is %u instead of 2",
+                     pamP->depth);
+        if (pamP->maxval != 1)
+            pm_error("Input tuple type is BLACKANDWHITE_ALPHA, "
+                     "but maxval is %u instead of 1", (unsigned)pamP->maxval);
+
+        retval = PNG_COLOR_TYPE_GRAY_ALPHA;
+    } else if (strneq(pamP->tuple_type, "BLACKANDWHITE", 13)) {
         if (pamP->depth != 1)
             pm_error("Input tuple type is BLACKANDWHITE, "
                      "but number of planes is %u instead of 1",
@@ -785,7 +795,8 @@ pngBitDepth(unsigned int const pnmBitDepth,
     unsigned int retval;
 
     if ((pngColorType == PNG_COLOR_TYPE_RGB ||
-         pngColorType == PNG_COLOR_TYPE_RGB_ALPHA) &&
+         pngColorType == PNG_COLOR_TYPE_RGB_ALPHA ||
+         pngColorType == PNG_COLOR_TYPE_GRAY_ALPHA) &&
         pnmBitDepth < 8) {
 
         retval = 8;