diff --git a/Changes.md b/Changes.md index 59b9eebb32c..067ffdd7a01 100644 --- a/Changes.md +++ b/Changes.md @@ -24,6 +24,7 @@ Fixes - PrimitiveInspector : Fixed bug which claimed "Location does not exist" for objects without any primitive variables. - OpenColorIO : Fixed the display transform used to show colours in popups. - SceneInspector : Fixed "Show History" menu items. +- ImageGadget : Fixed loading of non-8-bit images. Among other things, this fixes the display of 16 bit node icons in the GraphEditor. API --- diff --git a/src/GafferUI/ImageGadget.cpp b/src/GafferUI/ImageGadget.cpp index 87744baf5d7..25800328e80 100644 --- a/src/GafferUI/ImageGadget.cpp +++ b/src/GafferUI/ImageGadget.cpp @@ -138,7 +138,7 @@ using TextureCache = IECorePreview::LRUCache; IECoreGL::ConstTexturePtr textureGetter( const TextureCacheKey &key, size_t &cost, const IECore::Canceller *canceller ) { - const OIIO::ImageSpec config( OIIO::TypeDesc::UCHAR ); + const OIIO::ImageSpec config( OIIO::TypeDesc::UINT8 ); const std::string fileName = resolvedFileName( key.fileName ); OIIO::ImageBuf imageBuf( fileName, /* subimage = */ 0, /* miplevel = */ 0, /* imagecache = */ nullptr, &config ); imageBuf = OIIO::ImageBufAlgo::flip( imageBuf ); @@ -153,6 +153,10 @@ IECoreGL::ConstTexturePtr textureGetter( const TextureCacheKey &key, size_t &cos ); imageBuf = OIIO::ImageBufAlgo::colorconvert( imageBuf, colorProcessor.get(), true ); + if( imageBuf.spec().format != OIIO::TypeDesc::UINT8 ) + { + imageBuf = imageBuf.copy( OIIO::TypeDesc::UINT8 ); + } GLint pixelFormat; switch( imageBuf.nchannels() )