From ae56cc6c44f70981f509f0055f78926898aa091e Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Mon, 30 Apr 2018 04:38:11 +0200
Subject: [PATCH] Properly handle color profiles

Signed-off-by: Janne Koschinski <janne@kuschku.de>
---
 util.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/util.go b/util.go
index 1999a1f..f84628b 100644
--- a/util.go
+++ b/util.go
@@ -96,7 +96,14 @@ func resize(wand *imagick.MagickWand, wandLinear *imagick.MagickWand, size Size,
 	}
 
 	mw.StripImage()
-	mw.SetImageColorspace(colorSpace)
+	iccProfile := wand.GetImageProfile("ICC")
+	if iccProfile != "" {
+		mw.SetImageProfile("ICC", []byte(iccProfile))
+	}
+	iptcProfile := wand.GetImageProfile("IPTC")
+	if iptcProfile != "" {
+		mw.SetImageProfile("IPTC", []byte(iptcProfile))
+	}
 
 	err = mw.WriteImage(target)
 
-- 
GitLab