From dc8787016f967ffb39b65d81d867d9b1190bfe4e Mon Sep 17 00:00:00 2001 From: Jason Ly Date: Mon, 29 Dec 2025 17:59:23 -0500 Subject: [PATCH 1/2] change bye bye to close file monitoring --- src/joomer-efsw-file-monitoring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joomer-efsw-file-monitoring.cpp b/src/joomer-efsw-file-monitoring.cpp index d724563..a12f6ae 100644 --- a/src/joomer-efsw-file-monitoring.cpp +++ b/src/joomer-efsw-file-monitoring.cpp @@ -16,7 +16,7 @@ void flip_image_vertically(unsigned char* data, int width, int height, int chann bool STOP = false; void sigend( int ) { - std::cout << std::endl << "Bye bye" << std::endl; + std::cout << std::endl << "close file monitoring" << std::endl; STOP = true; } From 2e6637b65d4e6e4f207404241e1c01367939ed97 Mon Sep 17 00:00:00 2001 From: Jason Ly Date: Mon, 29 Dec 2025 18:34:21 -0500 Subject: [PATCH 2/2] save flipped image as png --- src/joomer-efsw-file-monitoring.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/joomer-efsw-file-monitoring.cpp b/src/joomer-efsw-file-monitoring.cpp index a12f6ae..4b65818 100644 --- a/src/joomer-efsw-file-monitoring.cpp +++ b/src/joomer-efsw-file-monitoring.cpp @@ -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; } }