--- src/pnm.c 2006-08-23 00:33:58.000000000 +0200 +++ src/pnm.c.new 2006-09-01 01:15:48.000000000 +0200 @@ -280,7 +280,7 @@ pic=(unsigned char *)malloc( nx*ny ); if(pic==NULL)F0("memory failed"); // no memory /* this is a slow but short routine for P1 to P6 formats */ - if( c2=='5' && c2=='2' ) /* slow PGM-RAW/ASC read pixelwise */ + if( c2=='5' || c2=='2' ) /* slow PGM-RAW/ASC read pixelwise */ for (i=0;i>10) - + ((PPM_GREEN_WEIGHT * buf[2*bps-1] + 511)>>10) - + ((PPM_BLUE_WEIGHT * buf[3*bps-1] + 511)>>10); + = ((PPM_RED_WEIGHT * (unsigned char)buf[ bps-1] + 511)>>10) + + ((PPM_GREEN_WEIGHT * (unsigned char)buf[2*bps-1] + 511)>>10) + + ((PPM_BLUE_WEIGHT * (unsigned char)buf[3*bps-1] + 511)>>10); /* normalized to 0..255 */ } }