diff --git a/backend/png.c b/backend/png.c index 7f83237f..84c19c26 100644 --- a/backend/png.c +++ b/backend/png.c @@ -307,7 +307,11 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width /* make sure we have disengaged */ if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(wpng_info.outfile); + if(symbol->output_options & BARCODE_STDOUT) { + fflush(wpng_info.outfile); + } else { + fclose(wpng_info.outfile); + } return 0; } #endif /* NO_PNG */