diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 3703d417f11..6eb6fcb1262 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -2569,7 +2569,7 @@ bool BKE_imbuf_write(ImBuf *ibuf, const char *filepath, const ImageFormatData *i BKE_image_format_to_imbuf(ibuf, imf); const bool ok = IMB_save_image(ibuf, filepath, IB_byte_data); - if (ok == 0) { + if (!ok && errno != 0) { perror(filepath); } diff --git a/source/blender/imbuf/intern/oiio/openimageio_support.cc b/source/blender/imbuf/intern/oiio/openimageio_support.cc index d1eb815399e..611329e987e 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_support.cc +++ b/source/blender/imbuf/intern/oiio/openimageio_support.cc @@ -23,6 +23,7 @@ #include "CLG_log.h" static CLG_LogRef LOG_READ = {"image.read"}; +static CLG_LogRef LOG_WRITE = {"image.write"}; OIIO_NAMESPACE_USING @@ -132,7 +133,7 @@ static ImBuf *load_pixels( bool ok = in->read_image( 0, 0, 0, channels, format, ibuf_data, ibuf_xstride, -ibuf_ystride, AutoStride); if (!ok) { - CLOG_ERROR(&LOG_READ, "OpenImageIO read failed: failed: %s", in->geterror().c_str()); + CLOG_ERROR(&LOG_READ, "OpenImageIO read failed: %s", in->geterror().c_str()); IMB_freeImBuf(ibuf); return nullptr; @@ -364,7 +365,13 @@ bool imb_oiio_write(const WriteContext &ctx, const char *filepath, const ImageSp } } - return write_ok && close_ok; + const bool all_ok = write_ok && close_ok; + if (!all_ok) { + CLOG_ERROR(&LOG_WRITE, "OpenImageIO write failed: %s", out->geterror().c_str()); + errno = 0; /* Prevent higher level layers from calling `perror` unnecessarily. */ + } + + return all_ok; } WriteContext imb_create_write_context(const char *file_format,