about summary refs log tree commit diff
path: root/editor/pamsistoaglyph.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-03-27 03:11:13 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-03-27 03:11:13 +0000
commit6f9d75acb45235a93b1520beec7f96a98bde0412 (patch)
tree903719a5984cd8008cdd079af7a445de271c23e4 /editor/pamsistoaglyph.c
parente15e137ba527ba97c82149ad8c6bed59088d8616 (diff)
downloadnetpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.gz
netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.xz
netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.zip
Release 10.73.39
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4314 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pamsistoaglyph.c')
-rw-r--r--editor/pamsistoaglyph.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/pamsistoaglyph.c b/editor/pamsistoaglyph.c
index 6b093520..f9e25518 100644
--- a/editor/pamsistoaglyph.c
+++ b/editor/pamsistoaglyph.c
@@ -6,7 +6,7 @@
  *
  * ----------------------------------------------------------------------
  *
- * Copyright (C) 2009 Scott Pakin <scott+pbm@pakin.org>
+ * Copyright (C) 2009-2022 Scott Pakin <scott+pbm@pakin.org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -127,7 +127,10 @@ readAsGray( const char * const fileName,
         for (col = 0; col < pamP->width; ++col) {
             double YP, CbP, CrP;
 
-            pnm_YCbCrtuple( tuplerow[col], &YP, &CbP, &CrP );
+            if (pamP->depth >= 3)
+                pnm_YCbCrtuple(tuplerow[col], &YP, &CbP, &CrP);
+            else
+                YP = (double) tuplerow[col][0];
             grayArray[row][col] = (gray)
                 (YP * maxGrayVal / (double)pamP->maxval);
         }