// shrink image // #include "ppm.h" int main( void) { ppm a = ppm_read(); ppm n = ppm_new( a.rows/2, a.cols/2); for( int i = 0; i < n.rows; ++i) for( int j = 0; j < n.cols; ++j) { n.r[i][j] = a.r[2*i][2*j]; // copy every other pixel n.g[i][j] = a.g[2*i][2*j]; n.b[i][j] = a.b[2*i][2*j]; } ppm_write( n); return 0; }