Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Try to keep color space profile when saving EXR of incompatible type

Dmitry Kazakov5f69be279332
diff --git a/plugins/impex/exr/exr_converter.cc b/plugins/impex/exr/exr_converter.cc
index 852a98e423..50545cdc29 100644
--- a/plugins/impex/exr/exr_converter.cc
+++ b/plugins/impex/exr/exr_converter.cc
@@ -1090,10 +1090,21 @@ KisPaintDeviceSP wrapLayerDevice(KisPaintDeviceSP device)
const KoColorSpace *cs = device->colorSpace();
if (cs->colorDepthId() != Float16BitsColorDepthID && cs->colorDepthId() != Float32BitsColorDepthID) {
+ /**
+ * We should try to keep the same profile of the space when possible
+ * (i.e. when the color model is kept the same)
+ */
+ const KoColorProfile *targetBestEffortProfile = nullptr;
+ if (cs->colorModelId() == GrayAColorModelID ||
+ cs->colorModelId() == RGBAColorModelID) {
+ targetBestEffortProfile = cs->profile();
+ }
+
cs = KoColorSpaceRegistry::instance()->colorSpace(
cs->colorModelId() == GrayAColorModelID ?
GrayAColorModelID.id() : RGBAColorModelID.id(),
- Float16BitsColorDepthID.id());
+ Float16BitsColorDepthID.id(),
+ targetBestEffortProfile);
} else if (cs->colorModelId() != GrayAColorModelID &&
cs->colorModelId() != RGBAColorModelID) {
cs = KoColorSpaceRegistry::instance()->colorSpace(