From 3a97e716e4335edaf8c4639439674653160b742f Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 27 Feb 2022 04:39:35 +0000 Subject: Fix reference to planes 1 and 2 in 1-plane input git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4286 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pamsistoaglyph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'editor/pamsistoaglyph.c') 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 + * Copyright (C) 2009-2022 Scott Pakin * * 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); } -- cgit 1.4.1