Mercurial > hg > orthanc-wsi
diff Resources/Orthanc/Core/Images/ImageProcessing.cpp @ 100:16b8e1cc9bbf
Fix issue #30: Bad colorspace if using OpenSlide
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 20 Jan 2017 13:15:05 +0100 |
parents | ff0ef01c332c |
children | a3e8ac8b7256 |
line wrap: on
line diff
--- a/Resources/Orthanc/Core/Images/ImageProcessing.cpp Wed Jan 04 17:02:38 2017 +0100 +++ b/Resources/Orthanc/Core/Images/ImageProcessing.cpp Fri Jan 20 13:15:05 2017 +0100 @@ -458,6 +458,26 @@ return; } + if (target.GetFormat() == PixelFormat_RGB24 && + source.GetFormat() == PixelFormat_BGRA32) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + q[0] = p[2]; + q[1] = p[1]; + q[2] = p[0]; + p += 4; + q += 3; + } + } + + return; + } + if (target.GetFormat() == PixelFormat_RGBA32 && source.GetFormat() == PixelFormat_RGB24) {