#K40322. Image Color Inversion
Image Color Inversion
Image Color Inversion
You are given an image represented as a matrix with m rows and n columns. Each element of the matrix is an integer representing a pixel's color intensity, in the range \( [0, 255] \). Your task is to invert the image by replacing each pixel \( x \) with \( 255 - x \). For example, if a pixel value is 0, it becomes 255; if it is 255, it becomes 0; and if it is 100, it becomes 155.
The input and output formats are described below. Make sure to read the entire input from stdin and print your result to stdout.
inputFormat
The input is given in the following format:
- The first line contains two integers, m and n, representing the number of rows and columns of the image respectively.
- The following m lines each contain n space-separated integers representing the pixel values of the image.
outputFormat
Output the inverted image as m lines, where each line contains n space-separated integers representing the inverted pixel values. Each pixel in the inverted image is computed as \( 255 - x \), where \( x \) is the corresponding input pixel value.
## sample4 3
0 50 100
150 200 250
255 125 75
30 60 90
255 205 155
105 55 5
0 130 180
225 195 165
</p>