about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/libpnm3.c13
-rw-r--r--lib/pnm.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/libpnm3.c b/lib/libpnm3.c
index ba408bd1..4d88a2c1 100644
--- a/lib/libpnm3.c
+++ b/lib/libpnm3.c
@@ -240,6 +240,19 @@ pnm_invertxel(xel*   const xP,
 
 
 
+const char *
+pnm_formattypenm(int const format) {
+
+    switch (PPM_FORMAT_TYPE(format)) {
+    case PPM_TYPE: return "PPM"; break;
+    case PGM_TYPE: return "PGM"; break;
+    case PBM_TYPE: return "PBM"; break;
+    default: return "???";
+    }
+}
+
+
+
 void
 pnm_promoteformat(xel ** const xels,
                   int    const cols,
diff --git a/lib/pnm.h b/lib/pnm.h
index a8aad161..fd262566 100644
--- a/lib/pnm.h
+++ b/lib/pnm.h
@@ -136,6 +136,9 @@ pnm_invertxel(xel *  const x,
               xelval const maxval,
               int    const format);
 
+const char *
+pnm_formattypenm(int const format);
+
 void
 pnm_promoteformat(xel** xels, int cols, int rows, xelval maxval, int format,
                   xelval newmaxval, int newformat);