From b2fd36e619c4aa7314a8cb41aaa5e444f5683e25 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Mon, 30 Apr 2018 04:23:12 +0200
Subject: [PATCH] Improve colorspace handling

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

diff --git a/util.go b/util.go
index 0f196ec..1999a1f 100644
--- a/util.go
+++ b/util.go
@@ -11,15 +11,19 @@ func resize(wand *imagick.MagickWand, wandLinear *imagick.MagickWand, size Size,
 	var err error
 	var mw *imagick.MagickWand
 
-	colorSpace := mw.GetImageColorspace()
+	var colorSpace imagick.ColorspaceType
 
 	if size.Width == 0 && size.Height == 0 {
 		mw = wand.Clone()
 		defer mw.Destroy()
+
+		colorSpace = mw.GetImageColorspace()
 	} else {
 		mw = wandLinear.Clone()
 		defer mw.Destroy()
 
+		colorSpace = mw.GetImageColorspace()
+
 		width := mw.GetImageWidth()
 		height := mw.GetImageHeight()
 
-- 
GitLab