about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-05-15 15:33:36 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-05-15 15:33:36 +0000
commitd4566d57cc0fca7f31aee276b2e1522dd3c455c1 (patch)
treec02a1dffde80e6b37a427ac9f773646c41ded60a
parent618539817adc09d31ef6bc16b9d48f4bbc902d35 (diff)
downloadnetpbm-mirror-d4566d57cc0fca7f31aee276b2e1522dd3c455c1.tar.gz
netpbm-mirror-d4566d57cc0fca7f31aee276b2e1522dd3c455c1.tar.xz
netpbm-mirror-d4566d57cc0fca7f31aee276b2e1522dd3c455c1.zip
Fix failure to recognize BLACKANDWHITE_ALPHA
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4103 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pamtopng.c10
-rw-r--r--doc/HISTORY6
2 files changed, 15 insertions, 1 deletions
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c
index 3a987820..a9d04029 100644
--- a/converter/other/pamtopng.c
+++ b/converter/other/pamtopng.c
@@ -287,6 +287,16 @@ 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_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", 3)) {
         if (pamP->depth != 1)
             pm_error("Input tuple type is BLACKANDWHITE, "
diff --git a/doc/HISTORY b/doc/HISTORY
index 0fc4e497..7370d698 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,9 +6,13 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.95.00
 
+              pamtopng: Fix rejection of all BLACKANDWHITE_ALPHA images
+              with message about wrong depth.  Always broken (pamtopng
+              was new in Netpbm 10.71 (June 2015)),
+
               pamtogif: Fix failure with bogus message about wrong depth with
               grayscale and black and white PAM images with transparency.
-              Always broken (pamtogif was new in Netpbm 10.37 (December 2006).
+              Always broken (pamtogif was new in Netpbm 10.37 (December 2006)).
               Thanks Karol Kosek <krkk@krkk.ct8.pl>.
 
               ppmtogif: Same as 'pamtogif' fix above, but with -alpha option.