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++

WebP: preserve color profile on export if color model is RGB(A)

Rasyuqa A. H.19410f90fe5e
diff --git a/plugins/impex/webp/kis_webp_export.cpp b/plugins/impex/webp/kis_webp_export.cpp
index 481c17cb86..be98b710ac 100644
--- a/plugins/impex/webp/kis_webp_export.cpp
+++ b/plugins/impex/webp/kis_webp_export.cpp
@@ -300,6 +300,12 @@ KisImportExportErrorCode KisWebPExport::convert(KisDocument *document, QIODevice
const KisPaintDeviceSP src = dev;
const KoID depthId = src->colorSpace()->colorDepthId();
const KoColorSpace *destCs = KoColorSpaceRegistry::instance()->rgb8();
+ if (cs->colorModelId() == RGBAColorModelID) {
+ // Preserve color profile if model is RGB
+ destCs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(),
+ Integer8BitsColorDepthID.id(),
+ src->colorSpace()->profile());
+ }
const KoColorSpace *mixCs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(),
depthId.id(),
destCs->profile());
@@ -416,6 +422,12 @@ KisImportExportErrorCode KisWebPExport::convert(KisDocument *document, QIODevice
const KisPaintDeviceSP src = document->savingImage()->projection();
const KoID depthId = src->colorSpace()->colorDepthId();
const KoColorSpace *destCs = KoColorSpaceRegistry::instance()->rgb8();
+ if (cs->colorModelId() == RGBAColorModelID) {
+ // Preserve color profile if model is RGB
+ destCs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(),
+ Integer8BitsColorDepthID.id(),
+ src->colorSpace()->profile());
+ }
const KoColorSpace *mixCs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(),
depthId.id(),
destCs->profile());