diff --git a/README.md b/README.md index 652595f..d992e71 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,12 @@ image formats. The following image formats have read-only support: - Animated Windows cursors (ani) +- Camera RAW images (arw, cr2, cr3, dcs, dng, ...) - Gimp (xcf) - OpenEXR (exr) - Photoshop documents (psd, psb, pdd, psdt) +- Radiance HDR (hdr) - Sun Raster (ras) -- Camera RAW images (arw, cr2, cr3, dcs, dng, ...) The following image formats have read and write support: diff --git a/autotests/read/hdr/rgb-landscape.png b/autotests/read/hdr/rgb-landscape.png index 1da6ff1..4a96be1 100755 Binary files a/autotests/read/hdr/rgb-landscape.png and b/autotests/read/hdr/rgb-landscape.png differ diff --git a/autotests/read/hdr/rgb-portrait.png b/autotests/read/hdr/rgb-portrait.png index 129cb98..1acc495 100644 Binary files a/autotests/read/hdr/rgb-portrait.png and b/autotests/read/hdr/rgb-portrait.png differ diff --git a/autotests/read/hdr/rgb.png b/autotests/read/hdr/rgb.png index 503abd9..7948b9e 100644 Binary files a/autotests/read/hdr/rgb.png and b/autotests/read/hdr/rgb.png differ diff --git a/src/imageformats/hdr.cpp b/src/imageformats/hdr.cpp index 14dd32b..5eb5fe0 100644 --- a/src/imageformats/hdr.cpp +++ b/src/imageformats/hdr.cpp @@ -9,6 +9,7 @@ #include "hdr_p.h" #include "util_p.h" +#include #include #include #include @@ -28,11 +29,8 @@ namespace // Private. static inline uchar ClipToByte(float value) { - if (value > 255.0f) { - return 255; - } - // else if (value < 0.0f) return 0; // we know value is positive. - return uchar(value); + // we know value is positive. + return uchar(std::min(value + 0.5f, 255.0f)); } // read an old style line from the hdr image file @@ -242,6 +240,9 @@ bool HDRHandler::read(QImage *outImage) // qDebug() << "Error loading HDR file."; return false; } + // The images read by Gimp and Photoshop (including those of the tests) are interpreted with linear color space. + // By setting the linear color space, programs that support profiles display HDR files as in GIMP and Photoshop. + img.setColorSpace(QColorSpace(QColorSpace::SRgbLinear)); *outImage = img; return true;