/* inverse.c */ #include #include #include "mypgm.h" void make_inverse_image( ) /* inverse of image1 is output into image2 */ { int x, y; /* control variable */ printf("Image gray level inversion is performed\n\n"); x_size2 = x_size1; /* Width */ y_size2 = y_size1; /* Height */ for (y = 0; y < y_size2; y++) { for (x = 0; x < x_size2; x++) { image2[y][x] = (unsigned char) (MAX_BRIGHTNESS - image1[y][x]); } } } main( ) { load_image_data( ); /* Input of image1 */ make_inverse_image( ); /* Inversion operation */ save_image_data( ); /* Output of image2 */ return 0; }