addec clamping to the write_pixels_to_ppm function to make produce valid PPM format