about summary refs log tree commit diff
path: root/other/pamdepth.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-29 04:29:01 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-29 04:29:01 +0000
commit54191112065200f118588896c756ed48d99a515e (patch)
tree8dc74b7bd24e6dc053d0bc320dc07c18a18825f2 /other/pamdepth.c
parentc227dbc080d862b734f5f220345746fc8d8146bf (diff)
downloadnetpbm-mirror-54191112065200f118588896c756ed48d99a515e.tar.gz
netpbm-mirror-54191112065200f118588896c756ed48d99a515e.tar.xz
netpbm-mirror-54191112065200f118588896c756ed48d99a515e.zip
Release 10.86.16
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3933 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other/pamdepth.c')
-rw-r--r--other/pamdepth.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/other/pamdepth.c b/other/pamdepth.c
index 71dae9d8..96613d07 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);