From 1fd361a1ea06e44286c213ca1f814f49306fdc43 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 19 Aug 2006 03:12:28 +0000 Subject: Create Subversion repository git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/ppm/ppmtoppm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 converter/ppm/ppmtoppm.c (limited to 'converter/ppm/ppmtoppm.c') diff --git a/converter/ppm/ppmtoppm.c b/converter/ppm/ppmtoppm.c new file mode 100644 index 00000000..500c9856 --- /dev/null +++ b/converter/ppm/ppmtoppm.c @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------- + ppmtoppm +------------------------------------------------------------------------------ + Part of the Netpbm package. + + Copy PPM image from Standard Input to Standard Output + + + By Bryan Henderson, San Jose CA 2002.09.07 + + Contributed to the public domain by its author 2002.09.07 +-----------------------------------------------------------------------------*/ + +#include "ppm.h" + +int +main(int argc, char *argv[]) { + int format; + int rows, cols; + pixval maxval; + int row; + pixel* pixelrow; + + ppm_init(&argc, argv); + + if (argc-1 != 0) + pm_error("Program takes no arguments. Input is from Standard Input"); + + ppm_readppminit(stdin, &cols, &rows, &maxval, &format); + + ppm_writeppminit(stdout, cols, rows, maxval, 0); + + pixelrow = ppm_allocrow(cols); + + for (row = 0; row < rows; row++) { + ppm_readppmrow(stdin, pixelrow, cols, maxval, format); + ppm_writeppmrow(stdout, pixelrow, cols, maxval, 0); + } + ppm_freerow(pixelrow); + + pm_close(stdin); + + exit(0); +} -- cgit 1.4.1