mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
Set linear color space and round fix
This commit is contained in:
parent
bcb5308545
commit
cf78907ff4
@ -14,11 +14,12 @@ image formats.
|
|||||||
The following image formats have read-only support:
|
The following image formats have read-only support:
|
||||||
|
|
||||||
- Animated Windows cursors (ani)
|
- Animated Windows cursors (ani)
|
||||||
|
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
|
||||||
- Gimp (xcf)
|
- Gimp (xcf)
|
||||||
- OpenEXR (exr)
|
- OpenEXR (exr)
|
||||||
- Photoshop documents (psd, psb, pdd, psdt)
|
- Photoshop documents (psd, psb, pdd, psdt)
|
||||||
|
- Radiance HDR (hdr)
|
||||||
- Sun Raster (ras)
|
- Sun Raster (ras)
|
||||||
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
|
|
||||||
|
|
||||||
The following image formats have read and write support:
|
The following image formats have read and write support:
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.7 KiB |
@ -9,6 +9,7 @@
|
|||||||
#include "hdr_p.h"
|
#include "hdr_p.h"
|
||||||
#include "util_p.h"
|
#include "util_p.h"
|
||||||
|
|
||||||
|
#include <QColorSpace>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
@ -28,11 +29,8 @@ namespace // Private.
|
|||||||
|
|
||||||
static inline uchar ClipToByte(float value)
|
static inline uchar ClipToByte(float value)
|
||||||
{
|
{
|
||||||
if (value > 255.0f) {
|
// we know value is positive.
|
||||||
return 255;
|
return uchar(std::min(value + 0.5f, 255.0f));
|
||||||
}
|
|
||||||
// else if (value < 0.0f) return 0; // we know value is positive.
|
|
||||||
return uchar(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// read an old style line from the hdr image file
|
// read an old style line from the hdr image file
|
||||||
@ -242,6 +240,9 @@ bool HDRHandler::read(QImage *outImage)
|
|||||||
// qDebug() << "Error loading HDR file.";
|
// qDebug() << "Error loading HDR file.";
|
||||||
return false;
|
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;
|
*outImage = img;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user