Merge branch 'main' of git.indoodle.com:jason/joomer-efsw-file-monitoring

This commit is contained in:
jason 2025-12-29 23:40:05 +00:00
commit e31eab7e80

View File

@ -16,7 +16,7 @@ void flip_image_vertically(unsigned char* data, int width, int height, int chann
bool STOP = false; bool STOP = false;
void sigend( int ) { void sigend( int ) {
std::cout << std::endl << "Bye bye" << std::endl; std::cout << std::endl << "close file monitoring" << std::endl;
STOP = true; STOP = true;
} }
@ -71,9 +71,15 @@ class UpdateListener : public efsw::FileWatchListener {
if (image_data) { if (image_data) {
std::cout << "Successfully loaded " << filename << " (" << width << "x" << height << ")" << std::endl; std::cout << "Successfully loaded " << filename << " (" << width << "x" << height << ")" << std::endl;
flip_image_vertically(image_data, width, height, channels); flip_image_vertically(image_data, width, height, channels);
std::string flipped_filename = dir + "flipped_" + filename; // Save flipped image
stbi_write_jpg(flipped_filename.c_str(), width, height, channels, image_data, 100);
stbi_image_free(image_data); 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; STOP = true;
} }
} }