about summary refs log tree commit diff
path: root/converter/other/xwdtopnm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-01-24 18:13:27 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-01-24 18:13:27 +0000
commitadd5f8a273d879c2bf6e83a60ec5fd46af90bae7 (patch)
tree2f084ea1285d602e274965404c238c8b3456419b /converter/other/xwdtopnm.c
parentc66eed87b949d1d1d0acdeef0406796b7aac888a (diff)
downloadnetpbm-mirror-add5f8a273d879c2bf6e83a60ec5fd46af90bae7.tar.gz
netpbm-mirror-add5f8a273d879c2bf6e83a60ec5fd46af90bae7.tar.xz
netpbm-mirror-add5f8a273d879c2bf6e83a60ec5fd46af90bae7.zip
add warning about two bytes sample output
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@824 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/xwdtopnm.c')
-rw-r--r--converter/other/xwdtopnm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c
index 37620694..23d5100c 100644
--- a/converter/other/xwdtopnm.c
+++ b/converter/other/xwdtopnm.c
@@ -1130,6 +1130,28 @@ reportInfo(int              const cols,
 
 
 
+static void
+warn16Bit(xelval const maxval) {
+/*----------------------------------------------------------------------------
+   This program is often used by users of X, and those users often use
+   'xv', which doesn't properly interpret PNM files with 16 bit samples.
+   Furthermore, the maxval is often much larger than the user assumes
+   because of PNM's need to use the same maxval for all color components,
+   while XWD often uses different resolution for each.
+
+   Users get really frustrated when Xv displays something other than the
+   original mimage, almost always assuming that means Xwdtopnm converted
+   incorrectly.
+-----------------------------------------------------------------------------*/
+
+    if (pm_maxvaltobits(maxval) > 8)
+        pm_message("WARNING: Producing maxval %u output.  This involves "
+                   "multiple bytes per sample, which some programs, e.g. "
+                   "'xv', can't handle.  See manual.", maxval);
+}
+
+
+
 static void 
 convertRowSimpleIndex(pixelReader *  const pixelReaderP,
                       int            const cols,
@@ -1323,6 +1345,8 @@ main(int argc, char *argv[]) {
             &colors, &bitsPerPixel, &bitsPerItem, 
             &compMask, &byteOrder, &bitOrder,
             cmdline.headerdump);
+
+    warn16Bit(maxval);
     
     if (verbose) 
         reportInfo(cols, rows, padright, maxval, visualclass,