Skip to content

Commit

Permalink
Log OpenImageIO error on open failure
Browse files Browse the repository at this point in the history
  • Loading branch information
pablode committed Oct 19, 2024
1 parent 21e3847 commit 05a716c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/libguc/src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,23 @@ namespace detail
int& channelCount)
{
#ifdef GUC_USE_OIIO
using namespace OIIO;
OIIO::Filesystem::IOMemReader memReader((void*) buffer.get(), bufferSize);

Filesystem::IOMemReader memReader((void*) buffer.get(), bufferSize);

auto image = ImageInput::open(path, nullptr, &memReader);
auto image = OIIO::ImageInput::open(path, nullptr, &memReader);
if (image)
{
assert(image->supports("ioproxy"));

const ImageSpec& spec = image->spec();
const OIIO::ImageSpec& spec = image->spec();
channelCount = spec.nchannels;
image->close();
return true;
}
else
{
std::string errStr = OIIO::geterror();
TF_RUNTIME_ERROR("OpenImageIO %s", errStr.c_str());
}
#else
int width, height;
int ok = stbi_info_from_memory((const stbi_uc*) buffer.get(), bufferSize, &width, &height, &channelCount);
Expand Down

0 comments on commit 05a716c

Please sign in to comment.