diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index 8f938c9b4..34a4a7966 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -1830,15 +1830,16 @@ int main(int argc, const char* argv[]) { if (results[i].data == nullptr) { continue; } + int write_ok; std::string final_image_path = i > 0 ? base_path + "_" + std::to_string(i + 1) + file_ext : base_path + file_ext; if (is_jpg) { - stbi_write_jpg(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel, + write_ok = stbi_write_jpg(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel, results[i].data, 90, get_image_params(params, params.seed + i).c_str()); - printf("save result JPEG image to '%s'\n", final_image_path.c_str()); + printf("save result JPEG image to '%s' (%s)\n", final_image_path.c_str(), write_ok==0 ? "failure":"success"); } else { - stbi_write_png(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel, + write_ok = stbi_write_png(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel, results[i].data, 0, get_image_params(params, params.seed + i).c_str()); - printf("save result PNG image to '%s'\n", final_image_path.c_str()); + printf("save result PNG image to '%s' (%s)\n", final_image_path.c_str(), write_ok==0 ? "failure":"success"); } } }