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; } }