#include #include #include void writeppm(char const * const image_buffer, int const image_size, int const width, int const height, std::string const filename){ std::ofstream file{filename, std::ios::binary}; file << "P6\n" << width << '\n' << height << "\n255\n"; file.write(image_buffer, image_size); } void writepgm(char const * const image_buffer, int const image_size, int const width, int const height, std::string const filename){ std::ofstream file{filename, std::ios::binary}; file << "P5\n" << width << '\n' << height << "\n255\n"; file.write(image_buffer, image_size); }