about summary refs log tree commit diff
path: root/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-29 04:25:35 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-29 04:25:35 +0000
commit8f5a58b1baa029f8375d7d4fd10959167f36468e (patch)
treee597f02a6f7d90535dde57d683f37e3e62acee9b /other
parentdae71e7c5d66dcd719c078285dada4c3c4ac3793 (diff)
downloadnetpbm-mirror-8f5a58b1baa029f8375d7d4fd10959167f36468e.tar.gz
netpbm-mirror-8f5a58b1baa029f8375d7d4fd10959167f36468e.tar.xz
netpbm-mirror-8f5a58b1baa029f8375d7d4fd10959167f36468e.zip
Promote BLACKANDWHITE pam to GRAYSCALE
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3931 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other')
-rw-r--r--other/pamdepth.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/other/pamdepth.c b/other/pamdepth.c
index a2d2b162..46601864 100644
--- a/other/pamdepth.c
+++ b/other/pamdepth.c
@@ -13,6 +13,7 @@
 
 #include "pm_c_util.h"
 #include "mallocvar.h"
+#include "nstring.h"
 #include "shhopt.h"
 #include "pam.h"
 
@@ -157,11 +158,19 @@ main(int argc, const char * argv[]) {
         outpam.maxval = cmdline.newMaxval;
 
         if (PNM_FORMAT_TYPE(inpam.format) == PBM_TYPE) {
-            pm_message( "promoting from PBM to PGM" );
             outpam.format = PGM_TYPE;
         } else
             outpam.format = inpam.format;
 
+        if (streq(inpam.tuple_type, PAM_PBM_TUPLETYPE)) {
+            pm_message("promoting from black and white to grayscale");
+            strcpy(outpam.tuple_type, PAM_PGM_TUPLETYPE);
+        } else if (streq(inpam.tuple_type, PAM_PBM_ALPHA_TUPLETYPE)) {
+            pm_message("promoting from black and white to grayscale");
+            strcpy(outpam.tuple_type, PAM_PGM_ALPHA_TUPLETYPE);
+        } else
+            strcpy(outpam.tuple_type, inpam.tuple_type);
+
         pnm_writepaminit(&outpam);
 
         transformRaster(&inpam, &outpam);