save flipped image as png

This commit is contained in:
Jason Ly 2025-12-29 18:34:21 -05:00
parent dc8787016f
commit 2e6637b65d

View File

@ -71,9 +71,15 @@ class UpdateListener : public efsw::FileWatchListener {
if (image_data) {
std::cout << "Successfully loaded " << filename << " (" << width << "x" << height << ")" << std::endl;
flip_image_vertically(image_data, width, height, channels);
std::string flipped_filename = dir + "flipped_" + filename;
stbi_write_jpg(flipped_filename.c_str(), width, height, channels, image_data, 100);
stbi_image_free(image_data);
// Save flipped image
std::string flipped_filename =
dir + "flipped_" + filename.substr( 0, filename.length() - 3 ) + "png";
//stbi_write_jpg(flipped_filename.c_str(), width, height, channels, image_data, 100);
stbi_write_png( flipped_filename.c_str(), width, height, channels, image_data,
width * channels );
//stbi_image_free(image_data);
STOP = true;
}
}